1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
8 int f(T
* ptr
, int T::*pm
) { // expected-error{{member pointer}}
13 template struct X1
<Y
>;
14 template struct X1
<int>; // expected-note{{instantiation}}
16 template<typename T
, typename Class
>
18 T
f(Class
&obj
, T
Class::*pm
) { // expected-error{{to a reference}} \
19 // expected-error{{member pointer to void}}
24 template struct X2
<int, Y
>;
25 template struct X2
<int&, Y
>; // expected-note{{instantiation}}
26 template struct X2
<const void, Y
>; // expected-note{{instantiation}}
28 template<typename T
, typename Class
, T
Class::*Ptr
>
30 X3
<T
, Class
, Ptr
> &operator=(const T
& value
) {
37 typedef int Y::*IntMember
;
39 template<IntMember Member
>
41 X3
<int, Y
, Member
> member
;
43 int &getMember(Y
& y
) { return y
.*Member
; }
46 int &get_X4(X4
<&Y::x
> x4
, Y
& y
) {
47 return x4
.getMember(y
);
50 template<IntMember Member
>
51 void accept_X4(X4
<Member
>);
53 void test_accept_X4(X4
<&Y::x
> x4
) {
57 namespace ValueDepMemberPointer
{
58 template <void (*)()> struct instantiate_function
{};
59 template <typename T
> struct S
{
60 static void instantiate();
61 typedef instantiate_function
<&S::instantiate
> x
; // expected-note{{instantiation}}
63 template <typename T
> void S
<T
>::instantiate() {
64 int a
[(int)sizeof(T
)-42]; // expected-error{{array with a negative size}}
70 struct A
{ struct { int n
; }; };
71 template<int A::*> struct X
{};
72 constexpr int A::*p
= &A::n
;
73 X
<p
> x
; // expected-error{{not a pointer to member constant}}