Skip to content

Commit

Permalink
A non-explicit constructor template with a second parameter that is a
Browse files Browse the repository at this point in the history
parameter pack is a converting constructor. Fixes PR13003.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158040 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
DougGregor committed Jun 5, 2012
1 parent 7453a72 commit 113c444
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/AST/DeclCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1695,7 +1695,9 @@ bool CXXConstructorDecl::isConvertingConstructor(bool AllowExplicit) const {
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 {
Expand Down
21 changes: 21 additions & 0 deletions test/CXX/special/class.conv/class.conv.ctor/p1.cpp
Original file line number Diff line number Diff line change
@@ -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();
}

0 comments on commit 113c444

Please sign in to comment.