2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.dg / init / elide3.C
blobe6d3300b56bc754d87703ec2dcdf2e06ba6e7ce4
1 // PR c++/8674
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.
7 // Test that we actually run the A copy constructor when calling f().
9 // { dg-do run }
11 int c;
13 struct A
15   A () { ++c; }
16   A (const A&) { ++c; }
19 struct B
21   A a;
24 void f (A) { }
26 int main ()
28   f (B().a);
29   return c < 2;