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