diff options
author | ed <ed@FreeBSD.org> | 2009-06-14 09:24:02 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-06-14 09:24:02 +0000 |
commit | b8e7410b22fa573fb0078712439f343bc69208dd (patch) | |
tree | d472a7615b5c7e413aa62a77d0777c1a9cf76478 /test/SemaTemplate/instantiate-member-pointers.cpp | |
parent | 6514d87c1aa5b544d02c3822fe41217e2051673d (diff) | |
download | FreeBSD-src-b8e7410b22fa573fb0078712439f343bc69208dd.zip FreeBSD-src-b8e7410b22fa573fb0078712439f343bc69208dd.tar.gz |
Import Clang r73340.
Diffstat (limited to 'test/SemaTemplate/instantiate-member-pointers.cpp')
-rw-r--r-- | test/SemaTemplate/instantiate-member-pointers.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/SemaTemplate/instantiate-member-pointers.cpp b/test/SemaTemplate/instantiate-member-pointers.cpp new file mode 100644 index 0000000..b3ddb3f --- /dev/null +++ b/test/SemaTemplate/instantiate-member-pointers.cpp @@ -0,0 +1,27 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +struct Y { + int x; +}; + +template<typename T> +struct X1 { + int f(T* ptr, int T::*pm) { // expected-error{{member pointer}} + return ptr->*pm; + } +}; + +template struct X1<Y>; +template struct X1<int>; // expected-note{{instantiation}} + +template<typename T, typename Class> +struct X2 { + T f(Class &obj, T Class::*pm) { // expected-error{{to a reference}} \ + // expected-error{{member pointer to void}} + return obj.*pm; + } +}; + +template struct X2<int, Y>; +template struct X2<int&, Y>; // expected-note{{instantiation}} +template struct X2<const void, Y>; // expected-note{{instantiation}} |