| 1 |
// PR c++/8186 |
| 2 |
|
| 3 |
// Bug: In f, convert_for_arg_passing wrapped the A TARGET_EXPR in an |
| 4 |
// ADDR_EXPR for passing by invisible ref. stabilize_throw_expr copied the |
| 5 |
// resulting pointer into a temporary. cp_convert_parm_for_inlining then |
| 6 |
// dereferences it and tries to initialize B::am with the INDIRECT_REF, |
| 7 |
// which calls for a bitwise copy. Which is broken. |
| 8 |
|
| 9 |
// { dg-options "-O" } |
| 10 |
|
| 11 |
struct A |
| 12 |
{ |
| 13 |
A(); |
| 14 |
A(const A&); |
| 15 |
A& operator=(const A&); |
| 16 |
}; |
| 17 |
|
| 18 |
struct B { |
| 19 |
A am; |
| 20 |
B(A a) { am = a; } |
| 21 |
}; |
| 22 |
|
| 23 |
void f () |
| 24 |
{ |
| 25 |
throw B(A()); |
| 26 |
} |