OSDN Git Service

* g++.dg/init/new1.C, g++.dg/template/alignof1.C,
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / init / elide2.C
1 // PR c++/8674
2
3 // Bug: Since B().a is an rvalue, we tried to treat it like a TARGET_EXPR
4 // and elide the copy.  But that produces a bitwise copy, which causes us
5 // to abort in cp_expr_size.
6
7 // Test that we actually run the A copy constructor when calling f().
8
9 // { dg-do run }
10
11 int c;
12
13 struct A
14 {
15   A () { ++c; }
16   A (const A&) { ++c; }
17 };
18
19 struct B
20 {
21   A a;
22 };
23
24 void f (A) { }
25
26 int main ()
27 {
28   f (B().a);
29   return c < 2;
30 }