]> granicus.if.org Git - clang/commitdiff
The Redeclarable part of named decls is read before their name.
authorAxel Naumann <Axel.Naumann@cern.ch>
Mon, 1 Oct 2012 09:51:27 +0000 (09:51 +0000)
committerAxel Naumann <Axel.Naumann@cern.ch>
Mon, 1 Oct 2012 09:51:27 +0000 (09:51 +0000)
Lookup can nevertheless find them due to the serialized lookup table.
For instance when reading a template decl's templatedDecl, it will search for existing decls that it could be a redeclaration of, and find the half-read template decl.
Thus there is no point in asserting the names of decls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164932 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Serialization/ASTReader.cpp
test/Modules/Inputs/redecl-merge-left.h

index 17296685c4e7edc4a242c1d418f0c4f7821a4f7a..639ef93fb6b4dea017687223b6907b8bfafc21bb 100644 (file)
@@ -4950,8 +4950,10 @@ namespace {
           continue;
 
         if (ND->getDeclName() != This->Name) {
-          assert(!This->Name.getCXXNameType().isNull() && 
-                 "Name mismatch without a type");
+          // A name might be null because the decl's redeclarable part is
+          // currently read before reading its name. The lookup is triggered by
+          // building that decl (likely indirectly), and so it is later in the
+          // sense of "already existing" and can be ignored here.
           continue;
         }
       
index a6ea6024c8551a23d4932f37d341461d05379aba..1f5da4f2e27da0f86011c2c8ba338ed525789a86 100644 (file)
@@ -88,12 +88,14 @@ template<> class List<bool> {
 public:
   void push_back(int);
 };
-
 namespace N {
-template<typename T> class Set {
-public:
-  void insert(T);
-};
+  template<typename T> class Set;
+}
+namespace N {
+  template<typename T> class Set {
+  public:
+    void insert(T);
+  };
 }
 #endif