• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-inaccessible-base %s
2 struct A {
3   virtual void f() = 0; // expected-note 2{{overridden virtual function}}
4 };
5 
6 struct Aprime : virtual A {
7   virtual void f();
8 };
9 
10 struct B : Aprime {
11   virtual void f(); // expected-note 3{{final overrider of 'A::f'}}
12 };
13 
14 struct C : virtual A {
15   virtual void f(); // expected-note{{final overrider of 'A::f'}}
16 };
17 
18 struct D : B, C { }; // expected-error{{virtual function 'A::f' has more than one final overrider in 'D'}}
19 
20 struct B2 : B { };
21 
22 struct E : B, B2 { }; //expected-error{{virtual function 'A::f' has more than one final overrider in 'E'}}
23 
24 struct F : B, B2 {
25   virtual void f(); // okay
26 };
27 
28 struct G : F { }; // okay
29 
30 struct H : G, A { }; // okay
31 
32 namespace MultipleSubobjects {
33   struct A { virtual void f(); };
34   struct B : A { virtual void f(); };
35   struct C : A { virtual void f(); };
36   struct D : B, C { }; // okay
37 }
38