From 8a3efe60fe849d95a248f73bd1b98fa217ea1efa Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Mon, 14 Jul 2014 19:37:30 -0400 Subject: [PATCH] StdTuple: Add note about redundant Applicative instance. --- include/boost/hana/ext/std/tuple.hpp | 5 +++- test/ext/std/tuple/bugs/libcxx_19616.cpp | 34 ++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 test/ext/std/tuple/bugs/libcxx_19616.cpp diff --git a/include/boost/hana/ext/std/tuple.hpp b/include/boost/hana/ext/std/tuple.hpp index b47e9dd82..c793ab4a2 100644 --- a/include/boost/hana/ext/std/tuple.hpp +++ b/include/boost/hana/ext/std/tuple.hpp @@ -73,7 +73,10 @@ namespace boost { namespace hana { { return helper(f, tuple, std::index_sequence_for{}); } }; - //! @todo Check `Applicative` laws. + //! @todo + //! Get rid of this redundant instance once + //! http://llvm.org/bugs/show_bug.cgi?id=19616 + //! is fixed. template <> struct Applicative::instance : Applicative::mcd { template diff --git a/test/ext/std/tuple/bugs/libcxx_19616.cpp b/test/ext/std/tuple/bugs/libcxx_19616.cpp new file mode 100644 index 000000000..e53ac1f25 --- /dev/null +++ b/test/ext/std/tuple/bugs/libcxx_19616.cpp @@ -0,0 +1,34 @@ +/* +@copyright Louis Dionne 2014 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) + */ + +#include + +#include + +#include +using namespace boost::hana; + + +int main() { + // Make sure we workaround the bug at: + // http://llvm.org/bugs/show_bug.cgi?id=19616 + BOOST_HANA_STATIC_ASSERT( + lift(std::make_tuple(1)) == + std::make_tuple(std::make_tuple(1)) + ); + + // The following shows the actual bug: +#if 0 + static_assert( + std::tuple_cat( + std::make_tuple(std::make_tuple(1)), + std::make_tuple() + ) + == + std::make_tuple(std::make_tuple(1)) + , ""); +#endif +}