[cfe-commits] r121363 - in /cfe/trunk: lib/Sema/SemaTemplateInstantiateDecl.cpp test/CodeGenCXX/anonymous-union-member-initializer.cpp
Francois Pichet
pichet2000 at gmail.com
Thu Dec 9 02:07:54 PST 2010
Author: fpichet
Date: Thu Dec 9 04:07:54 2010
New Revision: 121363
URL: http://llvm.org/viewvc/llvm-project?rev=121363&view=rev
Log:
Fix PR8760: IndirectFieldDecl Type was not updated during template instantiation.
Modified:
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/test/CodeGenCXX/anonymous-union-member-initializer.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=121363&r1=121362&r2=121363&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Thu Dec 9 04:07:54 2010
@@ -467,9 +467,10 @@
NamedChain[i++] = (SemaRef.FindInstantiatedDecl(D->getLocation(),
*PI, TemplateArgs));
+ QualType T = cast<FieldDecl>(NamedChain[i-1])->getType();
IndirectFieldDecl* IndirectField
= IndirectFieldDecl::Create(SemaRef.Context, Owner, D->getLocation(),
- D->getIdentifier(), D->getType(),
+ D->getIdentifier(), T,
NamedChain, D->getChainingSize());
Modified: cfe/trunk/test/CodeGenCXX/anonymous-union-member-initializer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/anonymous-union-member-initializer.cpp?rev=121363&r1=121362&r2=121363&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/anonymous-union-member-initializer.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/anonymous-union-member-initializer.cpp Thu Dec 9 04:07:54 2010
@@ -90,3 +90,16 @@
};
};
} s;
+
+
+ //PR8760
+ template <typename T>
+ struct Foo {
+ Foo() : ptr(__nullptr) {}
+ union {
+ T *ptr;
+ };
+ };
+ Foo<int> f;
+
+
More information about the cfe-commits
mailing list