summaryrefslogtreecommitdiff
path: root/test/SemaTemplate/member-access-ambig.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2012-12-02 13:20:44 +0000
committerDimitry Andric <dim@FreeBSD.org>2012-12-02 13:20:44 +0000
commit13cc256e404620c1de0cbcc4e43ce1e2dbbc4898 (patch)
tree2732d02d7d51218d6eed98ac7fcfc5b8794896b5 /test/SemaTemplate/member-access-ambig.cpp
parent657bc3d9848e3be92029b2416031340988cd0111 (diff)
Notes
Diffstat (limited to 'test/SemaTemplate/member-access-ambig.cpp')
-rw-r--r--test/SemaTemplate/member-access-ambig.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/SemaTemplate/member-access-ambig.cpp b/test/SemaTemplate/member-access-ambig.cpp
index f8a01d5fff2a..5c2d7617033f 100644
--- a/test/SemaTemplate/member-access-ambig.cpp
+++ b/test/SemaTemplate/member-access-ambig.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-unused-comparison %s
// PR8439
class A
@@ -43,3 +43,22 @@ namespace PR11134 {
};
}
+namespace AddrOfMember {
+ struct A { int X; };
+ typedef int (A::*P);
+ template<typename T> struct S : T {
+ void f() {
+ P(&T::X) // expected-error {{cannot cast from type 'int *' to member pointer type 'P'}}
+ == &A::X;
+ }
+ };
+
+ void g() {
+ S<A>().f(); // ok, &T::X is 'int (A::*)', not 'int *', even though T is a base class
+ }
+
+ struct B : A { static int X; };
+ void h() {
+ S<B>().f(); // expected-note {{here}}
+ }
+}