From 94bcae46d5c0481970c126a78ec62487e3dec735 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sun, 6 Sep 2009 01:31:23 +0000 Subject: [PATCH] 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 --- clang/lib/AST/ExprCXX.cpp | 2 -- clang/lib/Sema/SemaDeclCXX.cpp | 4 ++-- clang/test/SemaTemplate/default-expr-arguments.cpp | 5 +---- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp index 0cad283cb8d4..0ffb15287219 100644 --- a/clang/lib/AST/ExprCXX.cpp +++ b/clang/lib/AST/ExprCXX.cpp @@ -403,8 +403,6 @@ CXXConstructExpr::CXXConstructExpr(ASTContext &C, StmtClass SC, QualType T, Args = new (C) Stmt*[NumArgs]; for (unsigned i = 0; i < numargs; ++i) Args[i] = args[i]; - for (unsigned i = numargs; i < NumArgs; ++i) - Args[0] = 0; } } diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 89acfd14d6fb..3ee40e842c65 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -2899,8 +2899,8 @@ bool Sema::InitializeVarWithConstructor(VarDecl *VD, QualType DeclInitType, Expr **Exprs, unsigned NumExprs) { OwningExprResult TempResult = - BuildCXXConstructExpr(VD->getLocation(), DeclInitType, Constructor, - Exprs, NumExprs); + BuildCXXConstructExpr(/*FIXME: ConstructLoc*/ SourceLocation(), + DeclInitType, Constructor, Exprs, NumExprs); if (TempResult.isInvalid()) return true; diff --git a/clang/test/SemaTemplate/default-expr-arguments.cpp b/clang/test/SemaTemplate/default-expr-arguments.cpp index d689cc86e6b1..925d52fb19ac 100644 --- a/clang/test/SemaTemplate/default-expr-arguments.cpp +++ b/clang/test/SemaTemplate/default-expr-arguments.cpp @@ -20,7 +20,7 @@ void g() { } template 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'}} }; @@ -34,9 +34,6 @@ void g2() { void g3(F f, F s) { f.f(); s.f(); // expected-note{{in instantiation of default function argument expression for 'f' required here}} - - F f2; - F s2; // expected-note{{in instantiation of default function argument expression for 'F' required here}} } template struct G {