]> granicus.if.org Git - clang/commitdiff
PR29166: when merging declarations with typedef names for linkage purposes,
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 30 Aug 2016 19:13:18 +0000 (19:13 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 30 Aug 2016 19:13:18 +0000 (19:13 +0000)
don't assume that the anonymous struct will be part of the most recent
declaration of the typedef.

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

lib/Serialization/ASTReaderDecl.cpp
test/Modules/merge-name-for-linkage.cpp

index e00c9561cd876e154eeb680cb5ced3ee27ce9be2..620e1fed300d90ffd80d72e9c2cbbaf3f2455eae 100644 (file)
@@ -2887,7 +2887,7 @@ static NamedDecl *getDeclForMerging(NamedDecl *Found,
     return nullptr;
 
   if (auto *TND = dyn_cast<TypedefNameDecl>(Found))
-    return TND->getAnonDeclWithTypedefName();
+    return TND->getAnonDeclWithTypedefName(/*AnyRedecl*/true);
 
   return nullptr;
 }
index da1664ca343d7ccbe9d25384de5495a648fffb93..75534bd661b9615f8ed2d9fe5e0074be1d487f2a 100644 (file)
@@ -2,6 +2,7 @@
 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs/merge-name-for-linkage -verify %s
 // expected-no-diagnostics
 typedef union {} pthread_mutex_t;
+typedef pthread_mutex_t pthread_mutex_t;
 #include "a.h"
 pthread_mutex_t x;
 #include "b.h"