]> granicus.if.org Git - clang/commitdiff
Ignore dependent bases in ADL. Fixes PR5271.
authorSebastian Redl <sebastian.redl@getdesigned.at>
Sun, 25 Oct 2009 09:35:33 +0000 (09:35 +0000)
committerSebastian Redl <sebastian.redl@getdesigned.at>
Sun, 25 Oct 2009 09:35:33 +0000 (09:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85054 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaLookup.cpp

index abed5d4d1703e9c322c23d77ffa1182a0bcfa41f..93752e130c946abf49d60fde22d10aab1543da7c 100644 (file)
@@ -1239,6 +1239,14 @@ addAssociatedClassesAndNamespaces(CXXRecordDecl *Class,
                                          BaseEnd = Class->bases_end();
          Base != BaseEnd; ++Base) {
       const RecordType *BaseType = Base->getType()->getAs<RecordType>();
+      // In dependent contexts, we do ADL twice, and the first time around,
+      // the base type might be a dependent TemplateSpecializationType, or a
+      // TemplateTypeParmType. If that happens, simply ignore it.
+      // FIXME: If we want to support export, we probably need to add the
+      // namespace of the template in a TemplateSpecializationType, or even
+      // the classes and namespaces of known non-dependent arguments.
+      if (!BaseType)
+        continue;
       CXXRecordDecl *BaseDecl = cast<CXXRecordDecl>(BaseType->getDecl());
       if (AssociatedClasses.insert(BaseDecl)) {
         // Find the associated namespace for this base class.