summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/member-access-expr.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-09-02 23:58:38 +0000
committerDouglas Gregor <dgregor@apple.com>2009-09-02 23:58:38 +0000
commit64792e021dc387832f74f566495e80df3c084d7f (patch)
tree5b32057e328b5df15e1ca20238850ac41b669863 /clang/test/SemaTemplate/member-access-expr.cpp
parentfc39586b4f2c06a2debfb462b108c1e0d1f3c81c (diff)
downloadbcm5719-llvm-64792e021dc387832f74f566495e80df3c084d7f.tar.gz
bcm5719-llvm-64792e021dc387832f74f566495e80df3c084d7f.zip
Add a wicked little test-case that illustrates what we have to deal
with to properly support member access expressions in templates. This test is XFAIL'd, because we get it completely wrong, but I've made the minimal changes to the representation to at least avoid a crash. llvm-svn: 80856
Diffstat (limited to 'clang/test/SemaTemplate/member-access-expr.cpp')
-rw-r--r--clang/test/SemaTemplate/member-access-expr.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/member-access-expr.cpp b/clang/test/SemaTemplate/member-access-expr.cpp
new file mode 100644
index 00000000000..f41dc2120ab
--- /dev/null
+++ b/clang/test/SemaTemplate/member-access-expr.cpp
@@ -0,0 +1,48 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+// XFAIL
+template<typename T>
+void call_f0(T x) {
+ x.Base::f0();
+}
+
+struct Base {
+ void f0();
+};
+
+struct X0 : Base {
+ typedef Base CrazyBase;
+};
+
+void test_f0(X0 x0) {
+ call_f0(x0);
+}
+
+template<typename TheBase, typename T>
+void call_f0_through_typedef(T x) {
+ typedef TheBase Base2;
+ x.Base2::f0();
+}
+
+void test_f0_through_typedef(X0 x0) {
+ call_f0_through_typedef<Base>(x0);
+}
+
+template<typename TheBase, typename T>
+void call_f0_through_typedef2(T x) {
+ typedef TheBase CrazyBase; // expected-note{{current scope}}
+ x.CrazyBase::f0(); // expected-error{{ambiguous}}
+}
+
+struct OtherBase { };
+
+struct X1 : Base, OtherBase {
+ typedef OtherBase CrazyBase; // expected-note{{object type}}
+};
+
+void test_f0_through_typedef2(X0 x0, X1 x1) {
+ call_f0_through_typedef2<Base>(x0);
+ call_f0_through_typedef2<OtherBase>(x1);
+ call_f0_through_typedef2<Base>(x1); // expected-note{{here}}
+}
+
+
OpenPOWER on IntegriCloud