| 1 |
/* { dg-do assemble } */ |
| 2 |
/* { dg-skip-if "" { ! { clmcpu } } } */ |
| 3 |
/* { dg-options "-O2 -mcpu=em" } */ |
| 4 |
|
| 5 |
template <class> struct A; |
| 6 |
int a; |
| 7 |
template <> struct A<char> { |
| 8 |
typedef int int_type; |
| 9 |
static int_type eof(); |
| 10 |
}; |
| 11 |
template <> struct A<wchar_t> { |
| 12 |
typedef int int_type; |
| 13 |
static int_type eof() { return -1; } |
| 14 |
}; |
| 15 |
class basic_streambuf { |
| 16 |
public: |
| 17 |
virtual ~basic_streambuf(); |
| 18 |
}; |
| 19 |
class B { |
| 20 |
void tie(); |
| 21 |
class C { |
| 22 |
C(); |
| 23 |
}; |
| 24 |
}; |
| 25 |
template <typename _CharT, typename _Traits = A<_CharT>> |
| 26 |
class D : basic_streambuf { |
| 27 |
typedef _Traits traits_type; |
| 28 |
typename traits_type::int_type _M_unget_buf; |
| 29 |
|
| 30 |
public: |
| 31 |
D(void *) : _M_unget_buf(traits_type::eof()) {} |
| 32 |
}; |
| 33 |
|
| 34 |
extern D<wchar_t> b; |
| 35 |
B c; |
| 36 |
void *operator new(unsigned, void *p2) { return p2; } |
| 37 |
|
| 38 |
B::C::C() { |
| 39 |
new D<char>(&a); |
| 40 |
c.tie(); |
| 41 |
new (&b) D<wchar_t>(&a); |
| 42 |
} |