Revert "Initialize default CXXConstructExpr arguments to 0. Fixes a crash when
destroying the CXXConstructExpr.", this is causing test failures across the
board.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81100 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp
index 0cad283..0ffb152 100644
--- a/lib/AST/ExprCXX.cpp
+++ b/lib/AST/ExprCXX.cpp
@@ -403,8 +403,6 @@
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/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 89acfd1..3ee40e8 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -2899,8 +2899,8 @@
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/test/SemaTemplate/default-expr-arguments.cpp b/test/SemaTemplate/default-expr-arguments.cpp
index d689cc8..925d52f 100644
--- a/test/SemaTemplate/default-expr-arguments.cpp
+++ b/test/SemaTemplate/default-expr-arguments.cpp
@@ -20,7 +20,7 @@
}
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'}}
};
@@ -34,9 +34,6 @@
void g3(F<int> f, F<struct S> s) {
f.f();
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 {