Revert "Initialize default CXXConstructExpr arguments to 0. Fixes a crash when

destroying the CXXConstructExpr.", this is causing test failures across the
board.

llvm-svn: 81100
This commit is contained in:
Daniel Dunbar 2009-09-06 01:31:23 +00:00
parent f87be558cf
commit 94bcae46d5
3 changed files with 3 additions and 8 deletions

View File

@ -403,8 +403,6 @@ CXXConstructExpr::CXXConstructExpr(ASTContext &C, StmtClass SC, QualType T,
Args = new (C) Stmt*[NumArgs]; Args = new (C) Stmt*[NumArgs];
for (unsigned i = 0; i < numargs; ++i) for (unsigned i = 0; i < numargs; ++i)
Args[i] = args[i]; Args[i] = args[i];
for (unsigned i = numargs; i < NumArgs; ++i)
Args[0] = 0;
} }
} }

View File

@ -2899,8 +2899,8 @@ bool Sema::InitializeVarWithConstructor(VarDecl *VD,
QualType DeclInitType, QualType DeclInitType,
Expr **Exprs, unsigned NumExprs) { Expr **Exprs, unsigned NumExprs) {
OwningExprResult TempResult = OwningExprResult TempResult =
BuildCXXConstructExpr(VD->getLocation(), DeclInitType, Constructor, BuildCXXConstructExpr(/*FIXME: ConstructLoc*/ SourceLocation(),
Exprs, NumExprs); DeclInitType, Constructor, Exprs, NumExprs);
if (TempResult.isInvalid()) if (TempResult.isInvalid())
return true; return true;

View File

@ -20,7 +20,7 @@ void g() {
} }
template<typename T> struct F { template<typename T> struct F {
F(T t = 10); // expected-error{{cannot initialize 't' with an rvalue of type 'int'}} F(T t = 10);
void f(T t = 10); // expected-error{{cannot initialize 't' with an rvalue of type 'int'}} void f(T t = 10); // expected-error{{cannot initialize 't' with an rvalue of type 'int'}}
}; };
@ -34,9 +34,6 @@ void g2() {
void g3(F<int> f, F<struct S> s) { void g3(F<int> f, F<struct S> s) {
f.f(); f.f();
s.f(); // expected-note{{in instantiation of default function argument expression for 'f<struct S>' required here}} s.f(); // expected-note{{in instantiation of default function argument expression for 'f<struct S>' required here}}
F<int> f2;
F<S> s2; // expected-note{{in instantiation of default function argument expression for 'F<struct S>' required here}}
} }
template<typename T> struct G { template<typename T> struct G {