[cfe-commits] r158040 - in /cfe/trunk: lib/AST/DeclCXX.cpp test/CXX/special/class.conv/class.conv.ctor/p1.cpp
Douglas Gregor
dgregor at apple.com
Tue Jun 5 16:44:52 PDT 2012
Author: dgregor
Date: Tue Jun 5 18:44:51 2012
New Revision: 158040
URL: http://llvm.org/viewvc/llvm-project?rev=158040&view=rev
Log:
A non-explicit constructor template with a second parameter that is a
parameter pack is a converting constructor. Fixes PR13003.
Added:
cfe/trunk/test/CXX/special/class.conv/class.conv.ctor/p1.cpp
Modified:
cfe/trunk/lib/AST/DeclCXX.cpp
Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=158040&r1=158039&r2=158040&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Tue Jun 5 18:44:51 2012
@@ -1695,7 +1695,9 @@
return (getNumParams() == 0 &&
getType()->getAs<FunctionProtoType>()->isVariadic()) ||
(getNumParams() == 1) ||
- (getNumParams() > 1 && getParamDecl(1)->hasDefaultArg());
+ (getNumParams() > 1 &&
+ (getParamDecl(1)->hasDefaultArg() ||
+ getParamDecl(1)->isParameterPack()));
}
bool CXXConstructorDecl::isSpecializationCopyingObject() const {
Added: cfe/trunk/test/CXX/special/class.conv/class.conv.ctor/p1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.conv/class.conv.ctor/p1.cpp?rev=158040&view=auto
==============================================================================
--- cfe/trunk/test/CXX/special/class.conv/class.conv.ctor/p1.cpp (added)
+++ cfe/trunk/test/CXX/special/class.conv/class.conv.ctor/p1.cpp Tue Jun 5 18:44:51 2012
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -std=c++11 %s -verify
+
+namespace PR13003 {
+ struct void_type
+ {
+ template <typename Arg0, typename... Args>
+ void_type(Arg0&&, Args&&...) { }
+ };
+
+ struct void_type2
+ {
+ template <typename... Args>
+ void_type2(Args&&...) { }
+ };
+
+ struct atom { };
+
+ void_type v1 = atom();
+ void_type2 v2 = atom();
+}
+
More information about the cfe-commits
mailing list