p6-0x.cpp revision 944aa60777e6ea1015c9423107f7925f6d91f4a0
1// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s 2 3void f0() &; // expected-error{{ref-qualifier '&' is only allowed on non-static member functions, member function pointers, and typedefs of function types}} 4void f1() &&; // expected-error{{ref-qualifier '&&' is only allowed on non-static member functions, member function pointers, and typedefs of function types}} 5 6struct X { 7 void f0() &; 8 void f1() &&; 9 static void f2() &; // expected-error{{ref-qualifier '&' is only allowed on non-static member functions, member function pointers, and typedefs of function types}} 10 static void f3() &&; // expected-error{{ref-qualifier '&&' is only allowed on non-static member functions, member function pointers, and typedefs of function types}} 11}; 12 13typedef void func_type_lvalue() &; 14typedef void func_type_rvalue() &&; 15 16func_type_lvalue f2; // expected-error{{nonmember function cannot have a ref-qualifier '&'}} 17func_type_rvalue f3; // expected-error{{nonmember function cannot have a ref-qualifier '&&'}} 18 19struct Y { 20 func_type_lvalue f0; 21 func_type_rvalue f1; 22}; 23 24void (X::*mpf1)() & = &X::f0; 25void (X::*mpf2)() && = &X::f1; 26 27 28void (f() &&); // expected-error{{ref-qualifier '&&' is only allowed on non-static member functions, member function pointers, and typedefs of function types}} 29