| 1 |
// { dg-do assemble } |
| 2 |
// { dg-options "-O2" } |
| 3 |
// g++ crashed because we unsaved the TARGET_EXPR for the return value |
| 4 |
// for get_allocator without first expanding it, because it was part of the |
| 5 |
// cleanup for the temporary string. |
| 6 |
|
| 7 |
// Derived from libstdc++ v3 code. |
| 8 |
|
| 9 |
|
| 10 |
class AA {}; |
| 11 |
|
| 12 |
void fee (const AA&); |
| 13 |
|
| 14 |
class basic_string |
| 15 |
{ |
| 16 |
public: |
| 17 |
basic_string(const char*); |
| 18 |
|
| 19 |
~basic_string() |
| 20 |
{ fee (this->get_allocator()); } |
| 21 |
|
| 22 |
AA get_allocator(); |
| 23 |
}; |
| 24 |
|
| 25 |
class failure |
| 26 |
{ |
| 27 |
public: |
| 28 |
failure(const basic_string& __str); |
| 29 |
}; |
| 30 |
|
| 31 |
class foo |
| 32 |
{ |
| 33 |
public: |
| 34 |
foo(int x) |
| 35 |
{ |
| 36 |
throw failure (""); |
| 37 |
} |
| 38 |
}; |
| 39 |
|
| 40 |
void test05() |
| 41 |
{ |
| 42 |
foo ofs(0); |
| 43 |
} |