[cfe-commits] r81917 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/CodeGenCXX/PR4983-constructor-conversion.cpp

Anders Carlsson andersca at mac.com
Tue Sep 15 14:14:33 PDT 2009


Author: andersca
Date: Tue Sep 15 16:14:33 2009
New Revision: 81917

URL: http://llvm.org/viewvc/llvm-project?rev=81917&view=rev
Log:
Add back the workaround since it lead to constructor conversion bugs :(

Added:
    cfe/trunk/test/CodeGenCXX/PR4983-constructor-conversion.cpp
Modified:
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Tue Sep 15 16:14:33 2009
@@ -3243,6 +3243,12 @@
     Expr *Arg;
     if (i < NumArgs) {
       Arg = Args[i];
+      
+      // Pass the argument.
+      if (PerformCopyInitialization(Arg, ProtoArgType, "passing"))
+        return true;
+      
+      Args[i] = 0;
     } else {
       ParmVarDecl *Param = Constructor->getParamDecl(i);
       

Added: cfe/trunk/test/CodeGenCXX/PR4983-constructor-conversion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/PR4983-constructor-conversion.cpp?rev=81917&view=auto

==============================================================================
--- cfe/trunk/test/CodeGenCXX/PR4983-constructor-conversion.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/PR4983-constructor-conversion.cpp Tue Sep 15 16:14:33 2009
@@ -0,0 +1,16 @@
+// RUN: clang-cc -emit-llvm-only %s
+
+struct A {
+  A(const char *s){}
+};
+
+struct B {
+  A a;
+  
+  B() : a("test") { }
+};
+
+void f() {
+    A a("test");
+}
+





More information about the cfe-commits mailing list