]> granicus.if.org Git - clang/commitdiff
Fix PR4365.
authorAnders Carlsson <andersca@mac.com>
Fri, 12 Jun 2009 18:53:02 +0000 (18:53 +0000)
committerAnders Carlsson <andersca@mac.com>
Fri, 12 Jun 2009 18:53:02 +0000 (18:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73240 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaInherit.cpp
test/SemaTemplate/dependent-names.cpp [new file with mode: 0644]

index 1b968f0fbccef8fa2c002457b8c52cac4c7aca42..28ca5f64ef596cfb0c7eb58c22c5bca7d6bf909b 100644 (file)
@@ -138,6 +138,12 @@ bool Sema::LookupInBases(CXXRecordDecl *Class,
     // Find the record of the base class subobjects for this type.
     QualType BaseType = Context.getCanonicalType(BaseSpec->getType());
     BaseType = BaseType.getUnqualifiedType();
+
+    // If a base class of the class template depends on a template-parameter, 
+    // the base class scope is not examined during unqualified name lookup.
+    // [temp.dep]p3.
+    if (BaseType->isDependentType())
+      continue;
     
     // Determine whether we need to visit this base class at all,
     // updating the count of subobjects appropriately.
diff --git a/test/SemaTemplate/dependent-names.cpp b/test/SemaTemplate/dependent-names.cpp
new file mode 100644 (file)
index 0000000..95ee2d2
--- /dev/null
@@ -0,0 +1,16 @@
+// RUN: clang-cc -fsyntax-only -verify %s 
+
+typedef double A;
+template<typename T> class B {
+  typedef int A;
+};
+
+template<typename T> struct X : B<T> {
+  static A a;
+};
+
+int a0[sizeof(X<int>::a) == sizeof(double) ? 1 : -1];
+
+// PR4365.
+template<class T> class Q;
+template<class T> class R : Q<T> {T current;};