STL_MSFT created this revision. STL_MSFT added reviewers: EricWF, mclow.lists. STL_MSFT added a subscriber: cfe-commits.
bind's function call operator isn't guaranteed to SFINAE. There's nothing in the Standard that specifies this, and MSVC's implementation doesn't do it (we explode in a tuple bounds check). For portability, anything expecting the function call operator to vanish should be marked as libcxx-specific, unless and until a Library Issue is voted in saying otherwise. http://reviews.llvm.org/D22013 Files: test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp Index: test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp =================================================================== --- test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp +++ test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp @@ -24,6 +24,8 @@ #include <type_traits> #include <cassert> +#include "test_macros.h" + int dummy = 42; int return_value(int) { return dummy; } @@ -81,10 +83,10 @@ // Check that the call operator SFINAE's away when too few arguments // are provided but is well-formed otherwise. { - static_assert(!CheckCall<Bind>(), ""); + LIBCPP_STATIC_ASSERT(!CheckCall<Bind>(), ""); static_assert(CheckCall<Bind, int>(), ""); static_assert(CheckCall<Bind, int, int>(), ""); - static_assert(!CheckCall<BindR>(), ""); + LIBCPP_STATIC_ASSERT(!CheckCall<BindR>(), ""); static_assert(CheckCall<BindR, int>(), ""); static_assert(CheckCall<BindR, int, int>(), ""); } @@ -108,7 +110,7 @@ // Check that the call operator SFINAE's away when too few arguments // are provided but is well-formed otherwise. { - static_assert(!CheckCall<Bind>(), ""); + LIBCPP_STATIC_ASSERT(!CheckCall<Bind>(), ""); static_assert(CheckCall<Bind, int>(), ""); static_assert(CheckCall<Bind, int, int>(), ""); }
Index: test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp =================================================================== --- test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp +++ test/std/utilities/function.objects/bind/func.bind/func.bind.bind/bind_return_type.pass.cpp @@ -24,6 +24,8 @@ #include <type_traits> #include <cassert> +#include "test_macros.h" + int dummy = 42; int return_value(int) { return dummy; } @@ -81,10 +83,10 @@ // Check that the call operator SFINAE's away when too few arguments // are provided but is well-formed otherwise. { - static_assert(!CheckCall<Bind>(), ""); + LIBCPP_STATIC_ASSERT(!CheckCall<Bind>(), ""); static_assert(CheckCall<Bind, int>(), ""); static_assert(CheckCall<Bind, int, int>(), ""); - static_assert(!CheckCall<BindR>(), ""); + LIBCPP_STATIC_ASSERT(!CheckCall<BindR>(), ""); static_assert(CheckCall<BindR, int>(), ""); static_assert(CheckCall<BindR, int, int>(), ""); } @@ -108,7 +110,7 @@ // Check that the call operator SFINAE's away when too few arguments // are provided but is well-formed otherwise. { - static_assert(!CheckCall<Bind>(), ""); + LIBCPP_STATIC_ASSERT(!CheckCall<Bind>(), ""); static_assert(CheckCall<Bind, int>(), ""); static_assert(CheckCall<Bind, int, int>(), ""); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits