PR29166: when merging declarations with typedef names for linkage purposes,

don't assume that the anonymous struct will be part of the most recent
declaration of the typedef.

llvm-svn: 280136
This commit is contained in:
Richard Smith 2016-08-30 19:13:18 +00:00
parent 73b8dbdd94
commit 3fb1a8554d
2 changed files with 2 additions and 1 deletions
clang
lib/Serialization
test/Modules

View 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;
}

View 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"