]> granicus.if.org Git - clang/commitdiff
Add back the workaround since it lead to constructor conversion bugs :(
authorAnders Carlsson <andersca@mac.com>
Tue, 15 Sep 2009 21:14:33 +0000 (21:14 +0000)
committerAnders Carlsson <andersca@mac.com>
Tue, 15 Sep 2009 21:14:33 +0000 (21:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81917 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclCXX.cpp
test/CodeGenCXX/PR4983-constructor-conversion.cpp [new file with mode: 0644]

index 87c4e70101ecf1e98007d83b0895bc0e83d22635..9e497782507828c6230fc5bfae9453c9742a014b 100644 (file)
@@ -3243,6 +3243,12 @@ Sema::CompleteConstructorCall(CXXConstructorDecl *Constructor,
     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);
       
diff --git a/test/CodeGenCXX/PR4983-constructor-conversion.cpp b/test/CodeGenCXX/PR4983-constructor-conversion.cpp
new file mode 100644 (file)
index 0000000..31eae2e
--- /dev/null
@@ -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");
+}
+