| 1 |
// PR c++/67557 |
| 2 |
// { dg-do run } |
| 3 |
|
| 4 |
namespace std |
| 5 |
{ |
| 6 |
struct string |
| 7 |
{ |
| 8 |
typedef unsigned long size_type; |
| 9 |
const char* _M_p; |
| 10 |
char _M_local_buf[1]; |
| 11 |
|
| 12 |
string(const char* s) : _M_p(_M_local_buf) |
| 13 |
{ |
| 14 |
__builtin_printf("%p constructed\n", this); |
| 15 |
} |
| 16 |
|
| 17 |
string(const string& s) : _M_p(_M_local_buf) |
| 18 |
{ |
| 19 |
__builtin_printf("%p copied from %p\n", this, &s); |
| 20 |
} |
| 21 |
|
| 22 |
~string() |
| 23 |
{ |
| 24 |
__builtin_printf("%p destroyed\n", this); |
| 25 |
if (_M_p != _M_local_buf) |
| 26 |
__builtin_abort(); |
| 27 |
} |
| 28 |
}; |
| 29 |
} |
| 30 |
|
| 31 |
struct StartTag |
| 32 |
{ |
| 33 |
explicit StartTag(std::string const & tag) : tag_(tag), keepempty_(false) {} |
| 34 |
std::string tag_; |
| 35 |
bool keepempty_; |
| 36 |
}; |
| 37 |
|
| 38 |
StartTag fontToStartTag() { return StartTag(""); } |
| 39 |
|
| 40 |
struct FontTag : public StartTag |
| 41 |
{ |
| 42 |
FontTag() : StartTag(fontToStartTag()) {} |
| 43 |
}; |
| 44 |
|
| 45 |
int main() |
| 46 |
{ |
| 47 |
FontTag x; |
| 48 |
__builtin_printf("%p x.tag_ in main()\n", &x.tag_); |
| 49 |
return 0; |
| 50 |
} |