Index: include/tuple =================================================================== --- include/tuple +++ include/tuple @@ -706,7 +706,7 @@ typename enable_if < _CheckArgsConstructor< - sizeof...(_Up) <= sizeof...(_Tp) + sizeof...(_Up) == sizeof...(_Tp) && !_PackExpandsToThisTuple<_Up...>::value >::template __enable_implicit<_Up...>(), bool @@ -735,7 +735,11 @@ _CheckArgsConstructor< sizeof...(_Up) <= sizeof...(_Tp) && !_PackExpandsToThisTuple<_Up...>::value - >::template __enable_explicit<_Up...>(), + >::template __enable_explicit<_Up...>() || + _CheckArgsConstructor< + sizeof...(_Up) < sizeof...(_Tp) + && !_PackExpandsToThisTuple<_Up...>::value + >::template __enable_implicit<_Up...>(), bool >::type = false > Index: test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR27374_implicit_reduced_arity_extension_non_conforming.pass.cpp =================================================================== --- /dev/null +++ test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR27374_implicit_reduced_arity_extension_non_conforming.pass.cpp @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// UNSUPPORTED: c++98, c++03 + +// + +// template class tuple; + +// Check that the reduced arity constructors are never implicit. +// See also: +// http://llvm.org/PR27374 +// http://wg21.link/lwg2419 + +#include +#include +#include + +bool eat_tuple(const std::tuple& w) { return false; } +template +auto eat_char(Args&&... args) -> decltype(eat_tuple(args...)) { return eat_tuple(args...); } +bool eat_char(const char&) { return true; } + +int count(std::tuple) { + return 2; +} + +int count(std::tuple) { + return 3; +} + +using Tup = std::tuple; +Tup explicit_still_allowed() { return Tup{1, 2}; } + +int main() { + { + const char ch = 'a'; + assert(eat_char(ch)); + } + { + assert(count({ "hungry", "zombies" }) == 2); + assert(count({ "cute", "fluffy", "kittens" }) == 3); + } + { + explicit_still_allowed(); + } +}