[cfe-commits] r91883 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p5.cpp test/SemaCXX/default1.cpp test/SemaTemplate/default-expr-arguments.cpp

Eli Friedman eli.friedman at gmail.com
Mon Dec 21 18:46:13 PST 2009


Author: efriedma
Date: Mon Dec 21 20:46:13 2009
New Revision: 91883

URL: http://llvm.org/viewvc/llvm-project?rev=91883&view=rev
Log:
Switch default arguments over to InitializationSequence.


Modified:
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p5.cpp
    cfe/trunk/test/SemaCXX/default1.cpp
    cfe/trunk/test/SemaTemplate/default-expr-arguments.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=91883&r1=91882&r2=91883&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Mon Dec 21 20:46:13 2009
@@ -128,8 +128,12 @@
   InitializedEntity Entity = InitializedEntity::InitializeParameter(Param);
   InitializationKind Kind = InitializationKind::CreateCopy(Param->getLocation(),
                                                            EqualLoc);
-  if (CheckInitializerTypes(Arg, ParamType, Entity, Kind))
+  InitializationSequence InitSeq(*this, Entity, Kind, &Arg, 1);
+  OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind,
+                                          MultiExprArg(*this, (void**)&Arg, 1));
+  if (Result.isInvalid())
     return true;
+  Arg = Result.takeAs<Expr>();
 
   Arg = MaybeCreateCXXExprWithTemporaries(Arg);
 

Modified: cfe/trunk/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p5.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p5.cpp?rev=91883&r1=91882&r2=91883&view=diff

==============================================================================
--- cfe/trunk/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p5.cpp (original)
+++ cfe/trunk/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p5.cpp Mon Dec 21 20:46:13 2009
@@ -2,7 +2,7 @@
 
 float global_f;
 
-void f0(int *ip = &global_f); // expected-error{{incompatible}}
+void f0(int *ip = &global_f); // expected-error{{cannot initialize}}
 
 // Example from C++03 standard
 int a = 1; 

Modified: cfe/trunk/test/SemaCXX/default1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/default1.cpp?rev=91883&r1=91882&r2=91883&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/default1.cpp (original)
+++ cfe/trunk/test/SemaCXX/default1.cpp Mon Dec 21 20:46:13 2009
@@ -14,7 +14,7 @@
        int n);// expected-error {{missing default argument on parameter 'n'}}
 
 struct S { } s;
-void i(int = s) { } // expected-error {{incompatible type}}
+void i(int = s) { } // expected-error {{no viable conversion}}
 
 struct X { 
   X(int);

Modified: cfe/trunk/test/SemaTemplate/default-expr-arguments.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/default-expr-arguments.cpp?rev=91883&r1=91882&r2=91883&view=diff

==============================================================================
--- cfe/trunk/test/SemaTemplate/default-expr-arguments.cpp (original)
+++ cfe/trunk/test/SemaTemplate/default-expr-arguments.cpp Mon Dec 21 20:46:13 2009
@@ -100,7 +100,7 @@
 // PR5283
 namespace PR5283 {
 template<typename T> struct A {
-  A(T = 1); // expected-error 3 {{incompatible type initializing 'int', expected 'int *'}}
+  A(T = 1); // expected-error 3 {{cannot initialize a parameter of type 'int *' with an rvalue of type 'int'}}
 };
 
 struct B : A<int*> { 





More information about the cfe-commits mailing list