[cfe-commits] r73240 - in /cfe/trunk: lib/Sema/SemaInherit.cpp test/SemaTemplate/dependent-names.cpp

Anders Carlsson andersca at mac.com
Fri Jun 12 11:53:02 PDT 2009


Author: andersca
Date: Fri Jun 12 13:53:02 2009
New Revision: 73240

URL: http://llvm.org/viewvc/llvm-project?rev=73240&view=rev
Log:
Fix PR4365.

Added:
    cfe/trunk/test/SemaTemplate/dependent-names.cpp
Modified:
    cfe/trunk/lib/Sema/SemaInherit.cpp

Modified: cfe/trunk/lib/Sema/SemaInherit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInherit.cpp?rev=73240&r1=73239&r2=73240&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaInherit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInherit.cpp Fri Jun 12 13:53:02 2009
@@ -138,6 +138,12 @@
     // 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.

Added: cfe/trunk/test/SemaTemplate/dependent-names.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/dependent-names.cpp?rev=73240&view=auto

==============================================================================
--- cfe/trunk/test/SemaTemplate/dependent-names.cpp (added)
+++ cfe/trunk/test/SemaTemplate/dependent-names.cpp Fri Jun 12 13:53:02 2009
@@ -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;};





More information about the cfe-commits mailing list