diff options
author | Anders Carlsson <andersca@mac.com> | 2009-09-02 19:17:55 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-09-02 19:17:55 +0000 |
commit | f4b5f5c6a1487317aab9aa30d97bccfd57c82c98 (patch) | |
tree | 52a3c305b7b4068e2da51801d3f0abc97b078354 /lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | 1164d859c7828d3856f17e43da323332a5e3920e (diff) |
Fix a codegen crash when a class template has a constructor that does member initialization of an anonymous union.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80826 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 285cc62012..807115eb67 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -242,17 +242,19 @@ Decl *TemplateDeclInstantiator::VisitFieldDecl(FieldDecl *D) { D->getTypeSpecStartLoc(), D->getAccess(), 0); - if (Field) { - if (Invalid) - Field->setInvalidDecl(); - - if (!Field->getDeclName()) { - // Keep track of where this decl came from. - SemaRef.Context.setInstantiatedFromUnnamedFieldDecl(Field, D); - } + if (!Field) + return 0; + + if (Invalid) + Field->setInvalidDecl(); - 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; } |