aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/elide4.C
blob: 03335e4ffbd5e072a80b641c80a9c34d1681cb17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// { dg-do compile { target c++11 } }

// Check that there's a call to some base constructor of B: either the default
// constructor, if the copy is elided, or the copy constructor.

// { dg-final { scan-assembler {call[ \t]*_?_ZN1BC2} { target { i?86-*-* x86_64-*-* } } } }

int count;
struct A { int i = count++; };
struct B: virtual A {
  B() { }
  B(const B& b);
};
bool x;
struct C: B
{
  C() : B(x ? (0,B()) : B()) { }
};

int main()
{
  C c;
  return count;
}