]> granicus.if.org Git - clang/commitdiff
Revert "Initialize default CXXConstructExpr arguments to 0. Fixes a crash when
authorDaniel Dunbar <daniel@zuster.org>
Sun, 6 Sep 2009 01:31:23 +0000 (01:31 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sun, 6 Sep 2009 01:31:23 +0000 (01:31 +0000)
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

lib/AST/ExprCXX.cpp
lib/Sema/SemaDeclCXX.cpp
test/SemaTemplate/default-expr-arguments.cpp

index 0cad283cb8d47ccd06d54506d6ae7b9f1deb1af9..0ffb15287219a980e8107083550a7c5e4bde7375 100644 (file)
@@ -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;
     }
 }
 
index 89acfd14d6fbf5efdeff3520f979551b1452c783..3ee40e842c65f4b3a2d70b737d333c3372fbd2c7 100644 (file)
@@ -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;
   
index d689cc86e6b16c729b1798a7df5b66f6278c6d80..925d52fb19acba230023cb487194b4861713ad00 100644 (file)
@@ -20,7 +20,7 @@ void g() {
 }
 
 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 g2() {
 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 {