Douglas Gregor | 949bf69 | 2009-06-09 22:17:39 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
| 2 | |
| 3 | struct Y { |
| 4 | int x; |
| 5 | }; |
| 6 | |
| 7 | template<typename T> |
| 8 | struct X1 { |
| 9 | int f(T* ptr, int T::*pm) { // expected-error{{member pointer}} |
| 10 | return ptr->*pm; |
| 11 | } |
| 12 | }; |
| 13 | |
| 14 | template struct X1<Y>; |
| 15 | template struct X1<int>; // expected-note{{instantiation}} |
| 16 | |
| 17 | template<typename T, typename Class> |
| 18 | struct 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 | |
| 25 | template struct X2<int, Y>; |
| 26 | template struct X2<int&, Y>; // expected-note{{instantiation}} |
| 27 | template struct X2<const void, Y>; // expected-note{{instantiation}} |