| 1 |
// PR c++/13944 |
| 2 |
|
| 3 |
// Bug: When eliding the copy from the A temporary into the exception |
| 4 |
// object, we extended the throw prohibition to the constructor for the |
| 5 |
// temporary. This is wrong; the throw from A() should propagate normally |
| 6 |
// regardless of the elision of the temporary. |
| 7 |
|
| 8 |
// { dg-do run } |
| 9 |
|
| 10 |
struct A |
| 11 |
{ |
| 12 |
A() { throw 0; } |
| 13 |
}; |
| 14 |
|
| 15 |
int main() |
| 16 |
{ |
| 17 |
try |
| 18 |
{ |
| 19 |
throw A(); |
| 20 |
} |
| 21 |
catch(int i) |
| 22 |
{ |
| 23 |
return i; |
| 24 |
} |
| 25 |
catch (...) |
| 26 |
{ |
| 27 |
return 2; |
| 28 |
} |
| 29 |
return 3; |
| 30 |
} |