aboutsummaryrefslogtreecommitdiff
path: root/test/SemaTemplate/lookup-dependent-bases.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaTemplate/lookup-dependent-bases.cpp')
-rw-r--r--test/SemaTemplate/lookup-dependent-bases.cpp63
1 files changed, 49 insertions, 14 deletions
diff --git a/test/SemaTemplate/lookup-dependent-bases.cpp b/test/SemaTemplate/lookup-dependent-bases.cpp
index 61fca4a2a45f..f7867d8339bb 100644
--- a/test/SemaTemplate/lookup-dependent-bases.cpp
+++ b/test/SemaTemplate/lookup-dependent-bases.cpp
@@ -1,20 +1,55 @@
// RUN: %clang_cc1 -fms-compatibility -fsyntax-only -verify %s
-// expected-no-diagnostics
-class C {
-public:
- static void foo2() { }
+namespace basic {
+struct C {
+ static void foo2() {}
};
-template <class T>
-class A {
-public:
- typedef C D;
+template <typename T>
+struct A {
+ typedef C D;
};
-template <class T>
-class B : public A<T> {
-public:
- void foo() {
- D::foo2();
- }
+template <typename T>
+struct B : A<T> {
+ void foo() {
+ D::foo2(); // expected-warning {{use of undeclared identifier 'D'; unqualified lookup into dependent bases of class template 'B' is a Microsoft extension}}
+ }
};
+
+template struct B<int>; // Instantiation has no warnings.
+}
+
+namespace nested_nodep_base {
+// There are limits to our hacks, MSVC accepts this, but we don't.
+struct A {
+ struct D { static void foo2(); };
+};
+template <typename T>
+struct B : T {
+ struct C {
+ void foo() {
+ D::foo2(); // expected-error {{use of undeclared identifier 'D'}}
+ }
+ };
+};
+
+template struct B<A>; // Instantiation has no warnings.
+}
+
+namespace nested_dep_base {
+// We actually accept this because the inner class has a dependent base even
+// though it isn't a template.
+struct A {
+ struct D { static void foo2(); };
+};
+template <typename T>
+struct B {
+ struct C : T {
+ void foo() {
+ D::foo2(); // expected-warning {{use of undeclared identifier 'D'; unqualified lookup into dependent bases of class template 'C' is a Microsoft extension}}
+ }
+ };
+};
+
+template struct B<A>; // Instantiation has no warnings.
+}