blob: b3ddb3fafa313652fc3b46c6138d1adf07a38d19 [file] [log] [blame]
Douglas Gregor949bf692009-06-09 22:17:39 +00001// RUN: clang-cc -fsyntax-only -verify %s
2
3struct Y {
4 int x;
5};
6
7template<typename T>
8struct X1 {
9 int f(T* ptr, int T::*pm) { // expected-error{{member pointer}}
10 return ptr->*pm;
11 }
12};
13
14template struct X1<Y>;
15template struct X1<int>; // expected-note{{instantiation}}
16
17template<typename T, typename Class>
18struct X2 {
19 T f(Class &obj, T Class::*pm) { // expected-error{{to a reference}} \
20 // expected-error{{member pointer to void}}
21 return obj.*pm;
22 }
23};
24
25template struct X2<int, Y>;
26template struct X2<int&, Y>; // expected-note{{instantiation}}
27template struct X2<const void, Y>; // expected-note{{instantiation}}