forked from OSchip/llvm-project
Fix a codegen crash when a class template has a constructor that does member initialization of an anonymous union.
llvm-svn: 80826
This commit is contained in:
parent
b92c73a02a
commit
2e56cc6e6c
|
@ -242,17 +242,19 @@ Decl *TemplateDeclInstantiator::VisitFieldDecl(FieldDecl *D) {
|
|||
D->getTypeSpecStartLoc(),
|
||||
D->getAccess(),
|
||||
0);
|
||||
if (Field) {
|
||||
if (Invalid)
|
||||
Field->setInvalidDecl();
|
||||
if (!Field)
|
||||
return 0;
|
||||
|
||||
if (Invalid)
|
||||
Field->setInvalidDecl();
|
||||
|
||||
if (!Field->getDeclName()) {
|
||||
// Keep track of where this decl came from.
|
||||
SemaRef.Context.setInstantiatedFromUnnamedFieldDecl(Field, D);
|
||||
}
|
||||
|
||||
Owner->addDecl(Field);
|
||||
if (!Field->getDeclName()) {
|
||||
// Keep track of where this decl came from.
|
||||
SemaRef.Context.setInstantiatedFromUnnamedFieldDecl(Field, D);
|
||||
}
|
||||
|
||||
Field->setImplicit(D->isImplicit());
|
||||
Owner->addDecl(Field);
|
||||
|
||||
return Field;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
// RUN: clang-cc -emit-llvm -o %t %s
|
||||
template <typename T>
|
||||
class A
|
||||
{
|
||||
union { void *d; };
|
||||
|
||||
A() : d(0) { }
|
||||
};
|
||||
|
||||
A<int> a0;
|
Loading…
Reference in New Issue