Debian Codegraph @

gcc/testsuite/g++.dg/cpp1z/elide4.C

raw
1 // { dg-do compile { target c++11 } }
2
3 // Check that there's a call to some base constructor of B: either the default
4 // constructor, if the copy is elided, or the copy constructor.
5
6 // { dg-final { scan-assembler {call[ \t]*_?_ZN1BC2} { target { i?86-*-* x86_64-*-* } } } }
7
8 int count;
9 struct A { int i = count++; };
10 struct B: virtual A {
11 B() { }
12 B(const B& b);
13 };
14 bool x;
15 struct C: B
16 {
17 C() : B(x ? (0,B()) : B()) { }
18 };
19
20 int main()
21 {
22 C c;
23 return count;
24 }