diff options
-rw-r--r-- | lib/CodeGen/CGCXX.cpp | 4 | ||||
-rw-r--r-- | test/CodeGenCXX/vararg-conversion-ctor.cpp | 24 |
2 files changed, 27 insertions, 1 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index 0e6b5cb143..cc6f13be1a 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -649,8 +649,10 @@ void CodeGenModule::EmitCXXConstructor(const CXXConstructorDecl *D, llvm::Function * CodeGenModule::GetAddrOfCXXConstructor(const CXXConstructorDecl *D, CXXCtorType Type) { + const FunctionProtoType *FPT = D->getType()->getAs<FunctionProtoType>(); const llvm::FunctionType *FTy = - getTypes().GetFunctionType(getTypes().getFunctionInfo(D), false); + getTypes().GetFunctionType(getTypes().getFunctionInfo(D), + FPT->isVariadic()); const char *Name = getMangledCXXCtorName(D, Type); return cast<llvm::Function>( diff --git a/test/CodeGenCXX/vararg-conversion-ctor.cpp b/test/CodeGenCXX/vararg-conversion-ctor.cpp new file mode 100644 index 0000000000..d6110b7660 --- /dev/null +++ b/test/CodeGenCXX/vararg-conversion-ctor.cpp @@ -0,0 +1,24 @@ +// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -emit-llvm %s -o %t-64.ll && +// RUN: FileCheck -check-prefix LPLL64 --input-file=%t-64.ll %s && +// RUN: true + +extern "C" int printf(...); + +struct A { + A(...) { + printf("A::A(...)\n"); + } +}; + +A a(1.34); + +A b = 2.34; + +int main() +{ + A c[3]; +} + +// CHECK-LPLL64: call void (%struct.A*, ...) +// CHECK-LPLL64: call void (%struct.A*, ...) +// CHECK-LPLL64: call void (%struct.A*, ...) |