This patch implements Sema for clause 13.3.3.1p4.
It has to do with vararg constructors used as conversion
functions. Code gen needs work. This is WIP.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86207 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index dc57681..3408ff7 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -1086,18 +1086,21 @@
       } else if (const CXXConstructorDecl *Ctor = 
                   dyn_cast<CXXConstructorDecl>(FD)) {
         CastKind = CastExpr::CK_ConstructorConversion;
-
-        // If the user-defined conversion is specified by a constructor, the 
-        // initial standard conversion sequence converts the source type to the
-        // type required by the argument of the constructor
-        BeforeToType = Ctor->getParamDecl(0)->getType();
+        // Do no conversion if dealing with ... for the first conversion.
+        if (!ICS.UserDefined.EllipsisConversion)
+          // If the user-defined conversion is specified by a constructor, the 
+          // initial standard conversion sequence converts the source type to the
+          // type required by the argument of the constructor
+          BeforeToType = Ctor->getParamDecl(0)->getType();
       }    
       else
         assert(0 && "Unknown conversion function kind!");
-
-      if (PerformImplicitConversion(From, BeforeToType, 
-                                    ICS.UserDefined.Before, "converting"))
-        return true;
+      // Whatch out for elipsis conversion.
+      if (!BeforeToType.isNull()) {
+        if (PerformImplicitConversion(From, BeforeToType, 
+                                      ICS.UserDefined.Before, "converting"))
+          return true;
+      }
     
       OwningExprResult CastArg 
         = BuildCXXCastArgument(From->getLocStart(),