p3-0x.cpp revision 2e1c730167d2b978c66558c029d163ffe64b9656
1// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s 2 3namespace Test1 { 4 5struct B { 6 virtual void f(int); 7}; 8 9struct D : B { 10 virtual void f(long) override; // expected-error {{'f' marked 'override' but does not override any member functions}} 11 void f(int) override; 12}; 13} 14 15namespace Test2 { 16 17struct A { 18 virtual void f(int, char, int); 19}; 20 21template<typename T> 22struct B : A { 23 virtual void f(T) override; 24}; 25 26} 27 28namespace Test3 { 29 30struct A { 31 virtual void f(int, char, int); 32}; 33 34template<typename... Args> 35struct B : A { 36 virtual void f(Args...) override; // expected-error {{'f' marked 'override' but does not override any member functions}} 37}; 38 39template struct B<int, char, int>; 40template struct B<int>; // expected-note {{in instantiation of template class 'Test3::B<int>' requested here}} 41 42} 43 44namespace Test4 { 45struct B { 46 virtual void f() const final; // expected-note {{overridden virtual function is here}} 47}; 48 49struct D : B { 50 void f() const; // expected-error {{declaration of 'f' overrides a 'final' function}} 51}; 52 53} 54