1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 3 namespace PR6631 { 4 struct A { 5 virtual void f() = 0; 6 }; 7 8 struct B : virtual A { }; 9 10 struct C : virtual A { 11 virtual void f(); 12 }; 13 14 struct D : public B, public C { 15 virtual void f(); 16 }; 17 f()18 void f() { 19 (void)new D; // okay 20 } 21 } 22 23 // Check cases where we have a virtual function that is pure in one 24 // subobject but not pure in another subobject. 25 namespace PartlyPure { 26 struct A { 27 virtual void f() = 0; // expected-note{{unimplemented pure virtual method}} 28 }; 29 30 struct B : A { 31 virtual void f(); 32 }; 33 34 struct C : virtual A { }; 35 36 struct D : B, C { }; 37 f()38 void f() { 39 (void) new D; // expected-error{{abstract class}} 40 } 41 } 42 43 namespace NonPureAlongOnePath { 44 struct A { 45 virtual void f() = 0; 46 }; 47 48 struct B : virtual A { 49 virtual void f(); 50 }; 51 52 struct C : virtual A { }; 53 54 struct D : B, C { }; 55 f()56 void f() { 57 (void) new D; // okay 58 } 59 } 60 61 namespace NonPureAlongOnePath2 { 62 struct Aprime { 63 virtual void f() = 0; 64 }; 65 66 struct A : Aprime { 67 }; 68 69 struct B : virtual A { 70 virtual void f(); 71 }; 72 73 struct C : virtual A { }; 74 75 struct D : B, C { }; 76 f()77 void f() { 78 (void) new D; // okay 79 } 80 } 81