[modules] Delay loading the field declared with an anonymous tag declaration

until after we've had a chance to merge that tag.

llvm-svn: 219539
This commit is contained in:
Richard Smith 2014-10-10 22:37:41 +00:00
parent a8dd73229e
commit 337f7c9716
4 changed files with 18 additions and 1 deletions

View File

@ -535,7 +535,7 @@ ASTDeclReader::RedeclarableResult ASTDeclReader::VisitTagDecl(TagDecl *TD) {
TypedefNameForLinkage = Reader.GetIdentifierInfo(F, Record, Idx);
break;
case 3: // DeclaratorForAnonDecl
TD->NamedDeclOrQualifier = ReadDeclAs<NamedDecl>(Record, Idx);
NamedDeclForTagDecl = ReadDeclID(Record, Idx);
break;
default:
llvm_unreachable("unexpected tag info kind");

View File

@ -89,3 +89,11 @@ typedef PartiallyInstantiatePartialSpec<int*> PartiallyInstantiatePartialSpecHel
void InstantiateWithAliasTemplate(WithAliasTemplate<int>::X<char>);
inline int InstantiateWithAnonymousDeclsA(WithAnonymousDecls<int> x) { return (x.k ? x.a : x.b) + (x.k ? x.s.c : x.s.d) + x.e; }
inline int InstantiateWithAnonymousDeclsB2(WithAnonymousDecls<char> x);
template<typename T1 = int>
struct MergeAnonUnionMember {
MergeAnonUnionMember() { (void)values.t1; }
union { int t1; } values;
};
inline MergeAnonUnionMember<> maum_a() { return {}; }

View File

@ -11,3 +11,10 @@ template<typename T> struct MergeTemplateDefinitions {
static constexpr int g();
};
template<typename T> constexpr int MergeTemplateDefinitions<T>::g() { return 2; }
template<typename T1 = int>
struct MergeAnonUnionMember {
MergeAnonUnionMember() { (void)values.t1; }
union { int t1; } values;
};
inline MergeAnonUnionMember<> maum_c() { return {}; }

View File

@ -144,6 +144,8 @@ MergeSpecializations<double>::explicitly_specialized_in_b spec_in_b_2;
MergeSpecializations<bool>::explicitly_specialized_in_c spec_in_c_2;
#endif
MergeAnonUnionMember<> maum_main;
using AliasTemplateMergingTest = WithAliasTemplate<int>::X<char>;
int AnonymousDeclsMergingTest(WithAnonymousDecls<int> WAD, WithAnonymousDecls<char> WADC) {