| 1 |
// PR c++/89381 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
template<typename T> |
| 5 |
struct base |
| 6 |
{ |
| 7 |
base() { } |
| 8 |
base(const base&) { } |
| 9 |
base(base&&) { } |
| 10 |
base& operator=(const base&) { return *this; } |
| 11 |
base& operator=(base&&) { return *this; } |
| 12 |
}; |
| 13 |
|
| 14 |
struct foo : base<int> |
| 15 |
{ |
| 16 |
using base<int>::base; |
| 17 |
using base<int>::operator=; |
| 18 |
}; |
| 19 |
|
| 20 |
//using workaround = decltype(foo{*static_cast<foo const*>(0)}); |
| 21 |
|
| 22 |
struct bar |
| 23 |
{ |
| 24 |
bar& operator=(foo ve) |
| 25 |
{ |
| 26 |
value = ve; |
| 27 |
return *this; |
| 28 |
} |
| 29 |
|
| 30 |
foo value; |
| 31 |
}; |
| 32 |
|
| 33 |
int main() |
| 34 |
{ |
| 35 |
foo a; |
| 36 |
foo b{a}; |
| 37 |
} |