blob: 5b39e0ada7e2cf36c07f63fbc22d393e0c1d985b [file] [log] [blame]
Richard Smith762bb9d2011-10-13 22:29:44 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
Anders Carlssondfc2f102011-01-22 17:51:53 +00002namespace Test1 {
3
4class A final { }; // expected-note {{'A' declared here}}
5class B : A { }; // expected-error {{base 'A' is marked 'final'}}
6
7}
8
Anders Carlsson70280882011-01-22 18:07:06 +00009namespace Test2 {
10
11template<typename T> struct A final { }; // expected-note 2 {{'A' declared here}}
12struct B : A<int> { }; // expected-error {{base 'A' is marked 'final'}}
13
14template<typename T> struct C : A<T> { }; // expected-error {{base 'A' is marked 'final'}}
15struct D : C<int> { }; // expected-note {{in instantiation of template class 'Test2::C<int>' requested here}}
16
17}
18
19namespace Test3 {
20
21template<typename T> struct A { };
22template<> struct A<int> final { }; // expected-note {{'A' declared here}}
23
24struct B : A<bool> { };
25struct C : A<int> { }; // expected-error {{base 'A' is marked 'final'}}
26
27}
28
David Blaikieb6b5b972012-09-21 03:21:07 +000029namespace Test4 {
30
31struct A final { virtual void func() = 0; }; // expected-warning {{abstract class is marked 'final'}} expected-note {{unimplemented pure virtual method 'func' in 'A'}}
32struct B { virtual void func() = 0; }; // expected-note {{unimplemented pure virtual method 'func' in 'C'}}
33
34struct C final : B { }; // expected-warning {{abstract class is marked 'final'}}
35
36}