1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
5 template<typename T
> T
& lvalue();
6 template<typename T
> T
&& xvalue();
7 template<typename T
> T
prvalue();
9 // In a .* expression whose object expression is an rvalue, the
10 // program is ill-formed if the second operand is a pointer to member
11 // function with ref-qualifier &. In a ->* expression or in a .*
12 // expression whose object expression is an lvalue, the program is
13 // ill-formed if the second operand is a pointer to member function
14 // with ref-qualifier &&.
15 void test(X
*xp
, int (X::*pmf
)(int), int (X::*l_pmf
)(int) &,
16 int (X::*r_pmf
)(int) &&) {
18 (lvalue
<X
>().*pmf
)(17);
19 (xvalue
<X
>().*pmf
)(17);
20 (prvalue
<X
>().*pmf
)(17);
23 // Lvalue ref-qualifier.
24 (lvalue
<X
>().*l_pmf
)(17);
25 (xvalue
<X
>().*l_pmf
)(17); // expected-error-re{{pointer-to-member function type 'int (X::*)(int){{( __attribute__\(\(thiscall\)\))?}} &' can only be called on an lvalue}}
26 (prvalue
<X
>().*l_pmf
)(17); // expected-error-re{{pointer-to-member function type 'int (X::*)(int){{( __attribute__\(\(thiscall\)\))?}} &' can only be called on an lvalue}}
29 // Rvalue ref-qualifier.
30 (lvalue
<X
>().*r_pmf
)(17); // expected-error-re{{pointer-to-member function type 'int (X::*)(int){{( __attribute__\(\(thiscall\)\))?}} &&' can only be called on an rvalue}}
31 (xvalue
<X
>().*r_pmf
)(17);
32 (prvalue
<X
>().*r_pmf
)(17);
33 (xp
->*r_pmf
)(17); // expected-error-re{{pointer-to-member function type 'int (X::*)(int){{( __attribute__\(\(thiscall\)\))?}} &&' can only be called on an rvalue}}