| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
|
| 3 |
#define BUG |
| 4 |
struct type |
| 5 |
{ |
| 6 |
type() { } |
| 7 |
type(const type&) { } |
| 8 |
|
| 9 |
private: |
| 10 |
type(type&&); |
| 11 |
}; |
| 12 |
|
| 13 |
template<typename _Tp> |
| 14 |
struct identity |
| 15 |
{ |
| 16 |
typedef _Tp type; |
| 17 |
}; |
| 18 |
|
| 19 |
template<typename _Tp> |
| 20 |
inline _Tp&& |
| 21 |
forward(typename identity<_Tp>::type&& __t) |
| 22 |
{ return __t; } |
| 23 |
|
| 24 |
struct vec |
| 25 |
{ |
| 26 |
template<typename _Args> |
| 27 |
void |
| 28 |
bar(_Args&& __args) |
| 29 |
#ifdef BUG |
| 30 |
; |
| 31 |
#else |
| 32 |
{ |
| 33 |
type(forward<_Args>(__args)); |
| 34 |
} |
| 35 |
#endif |
| 36 |
}; |
| 37 |
|
| 38 |
#ifdef BUG |
| 39 |
template<typename _Args> |
| 40 |
void |
| 41 |
vec::bar(_Args&& __args) |
| 42 |
{ |
| 43 |
type(forward<_Args>(__args)); |
| 44 |
} |
| 45 |
#endif |
| 46 |
|
| 47 |
int main() |
| 48 |
{ |
| 49 |
vec v; |
| 50 |
type c; |
| 51 |
v.bar(c); |
| 52 |
} |