* decl.c (make_typename_type): s/parameters/arguments/.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / ref-qual2.C
blobfa09ab48a15bc8f874498e2f9a1246b20bf67b09
1 // In a .* expression whose object expression is an rvalue, the program is
2 // ill-formed if the second operand is a pointer to member function with
3 // ref-qualifier &. In a .* expression whose object expression is an
4 // lvalue, the program is ill-formed if the second operand is a pointer to
5 // member function with ref-qualifier &&.
7 // { dg-require-effective-target c++11 }
9 struct A {
10   void f() &;
11   void g() &&;
12   void h();
15 void one()
17   A a;
19   void (A::*p)() & = &A::f;
20   (a.*p)();
21   (A().*p)();                   // { dg-error "" }
23   p = &A::g;                    // { dg-error "" }
24   p = &A::h;                    // { dg-error "" }
26   void (A::*p2)() && = &A::g;
27   (A().*p2)();
28   (a.*p2)();                    // { dg-error "" }
29   p2 = &A::f;                   // { dg-error "" }
30   p2 = &A::h;                   // { dg-error "" }
32   void (A::*p3)() = &A::h;
33   (a.*p3)();
34   (A().*p3)();
35   p3 = &A::f;                   // { dg-error "" }
36   p3 = &A::g;                   // { dg-error "" }
39 template <class T>
40 struct B {
41   void f() &;
42   void g() &&;
43   void h();
46 template <class T>
47 void two()
49   B<T> a;
51   void (B<T>::*p)() & = &B<T>::f;
52   (a.*p)();
53   (B<T>().*p)();                // { dg-error "" }
55   p = &B<T>::g;                 // { dg-error "" }
56   p = &B<T>::h;                 // { dg-error "" }
58   void (B<T>::*p2)() && = &B<T>::g;
59   (B<T>().*p2)();
60   (a.*p2)();                    // { dg-error "" }
61   p2 = &B<T>::f;                // { dg-error "" }
62   p2 = &B<T>::h;                // { dg-error "" }
64   void (B<T>::*p3)() = &B<T>::h;
65   (a.*p3)();
66   (B<T>().*p3)();
67   p3 = &B<T>::f;                // { dg-error "" }
68   p3 = &B<T>::g;                // { dg-error "" }
71 int main()
73   one();
74   two<int>();