EricWF created this revision. EricWF added a reviewer: mclow.lists. EricWF added a subscriber: cfe-commits.
This patch fixes PR24779 (https://llvm.org/bugs/show_bug.cgi?id=24779) http://reviews.llvm.org/D13062 Files: include/tuple test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes_PR24779.pass.cpp Index: test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes_PR24779.pass.cpp =================================================================== --- /dev/null +++ test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes_PR24779.pass.cpp @@ -0,0 +1,40 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <tuple> + +// template <class... Types> class tuple; + +// template <class Alloc, class... UTypes> +// tuple(allocator_arg_t, const Alloc& a, UTypes&&...); + +// UNSUPPORTED: c++98, c++03 + +// Check that this constructor does not evaluate +// std::is_default_constructible<T> for any T in Types. + +#include <memory> +#include <tuple> + +template <class Tp = void> +struct BadDefaultCtor { + constexpr BadDefaultCtor() { + static_assert(!std::is_same<Tp, void>::value, ""); + } + + explicit BadDefaultCtor(int) {} +}; + +void DeleteFn(int*) {} + +int main() { + typedef BadDefaultCtor<> Type; + typedef std::tuple<Type, Type> Tuple; + Tuple t(Type(0), Type(0)); +} Index: include/tuple =================================================================== --- include/tuple +++ include/tuple @@ -635,7 +635,8 @@ >::value && __all_default_constructible< typename __make_tuple_types<tuple, sizeof...(_Tp), - sizeof...(_Up) < sizeof...(_Tp) ? + sizeof...(_Up) < sizeof...(_Tp) + && sizeof...(_Up) != 0 ? sizeof...(_Up) : sizeof...(_Tp)>::type >::value
Index: test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes_PR24779.pass.cpp =================================================================== --- /dev/null +++ test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes_PR24779.pass.cpp @@ -0,0 +1,40 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <tuple> + +// template <class... Types> class tuple; + +// template <class Alloc, class... UTypes> +// tuple(allocator_arg_t, const Alloc& a, UTypes&&...); + +// UNSUPPORTED: c++98, c++03 + +// Check that this constructor does not evaluate +// std::is_default_constructible<T> for any T in Types. + +#include <memory> +#include <tuple> + +template <class Tp = void> +struct BadDefaultCtor { + constexpr BadDefaultCtor() { + static_assert(!std::is_same<Tp, void>::value, ""); + } + + explicit BadDefaultCtor(int) {} +}; + +void DeleteFn(int*) {} + +int main() { + typedef BadDefaultCtor<> Type; + typedef std::tuple<Type, Type> Tuple; + Tuple t(Type(0), Type(0)); +} Index: include/tuple =================================================================== --- include/tuple +++ include/tuple @@ -635,7 +635,8 @@ >::value && __all_default_constructible< typename __make_tuple_types<tuple, sizeof...(_Tp), - sizeof...(_Up) < sizeof...(_Tp) ? + sizeof...(_Up) < sizeof...(_Tp) + && sizeof...(_Up) != 0 ? sizeof...(_Up) : sizeof...(_Tp)>::type >::value
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits