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