c++: robustify testcase [PR109752]
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1y / pr66443-cxx14.C
blobae76f7faa31c6309f55050ecfa39237c2a68fc96
1 // { dg-do run { target c++14 } }
3 // pr c++/66443 a synthesized ctor of an abstract class that's deleted
4 // only because of virtual base construction doesn't stop a derived
5 // class using it as a base object constructor (provided it has a
6 // suitable ctor invocation of the virtual base).
8 static int a_made;
10 struct A {
11   A *m_a = this;
12   A (int) { a_made++; }
15 struct B : virtual A {
16   A *m_b = this;
17   virtual bool Ok () = 0; // abstract
20 struct C : B {
21   // C::m_c is placed where a complete B object would put A
22   int m_c = 1729;
23 public:
24   C();
25   virtual bool Ok ();
28 bool C::Ok ()
30   // check everyone agreed on where A is
31   return a_made == 1 && m_a == this && m_b == this && m_c == 1729;
34 C::C ()
35   : A (1) // Explicit call of A's ctor
36 {  }
38 bool Ok (C &c)
40   return true;
43 int main ()
45   C c;
47   return !c.Ok ();