1 // { dg-do compile { target c++11 } } 2 3 #define BUG 4 struct type 5 { typetype6 type() { } typetype7 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&& forward(typename identity<_Tp>::type && __t)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 bar(_Args && __args)41 vec::bar(_Args&& __args) 42 { 43 type(forward<_Args>(__args)); 44 } 45 #endif 46 main()47int main() 48 { 49 vec v; 50 type c; 51 v.bar(c); 52 } 53