[cfe-commits] r89774 - in /cfe/trunk: lib/Sema/SemaTemplateInstantiateDecl.cpp test/CodeGenCXX/member-templates.cpp
Anders Carlsson
andersca at mac.com
Tue Nov 24 08:52:51 PST 2009
Author: andersca
Date: Tue Nov 24 10:52:50 2009
New Revision: 89774
URL: http://llvm.org/viewvc/llvm-project?rev=89774&view=rev
Log:
Fix a crash when "instantiating" VarDecls that are neither type nor value dependent.
Modified:
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/test/CodeGenCXX/member-templates.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=89774&r1=89773&r2=89774&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Tue Nov 24 10:52:50 2009
@@ -205,6 +205,7 @@
// we don't want to redo all the checking, especially since the
// initializer might have been wrapped by a CXXConstructExpr since we did
// it the first time.
+ Var->setType(D->getType());
Var->setInit(SemaRef.Context, Init.takeAs<Expr>());
}
else if (ParenListExpr *PLE = dyn_cast<ParenListExpr>((Expr *)Init.get())) {
Modified: cfe/trunk/test/CodeGenCXX/member-templates.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/member-templates.cpp?rev=89774&r1=89773&r2=89774&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/member-templates.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/member-templates.cpp Tue Nov 24 10:52:50 2009
@@ -18,3 +18,14 @@
// CHECK: define void @_ZN1BC1IiEET_(%struct.B* %this, i32)
// CHECK: define void @_ZN1BC2IiEET_(%struct.B* %this, i32)
template B::B(int);
+
+template<typename T>
+struct C {
+ void f() {
+ int a[] = { 1, 2, 3 };
+ }
+};
+
+void f(C<int>& c) {
+ c.f();
+}
More information about the cfe-commits
mailing list