p6-0x.cpp revision c938c1668b4fd12af154e965dd935a89e4801a70
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