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 {
AA15 A () { ++c; }
AA16 A (const A&) { ++c; }
17 };
18
19 struct B
20 {
21 A a;
22 };
23
f(A)24 void f (A) { }
25
main()26 int main ()
27 {
28 f (B().a);
29 return c < 2;
30 }
31