[PATCH] D22013: [libcxx] [test] bind's function call operator isn't guaranteed to SFINAE.

Stephan T. Lavavej via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 5 13:46:43 PDT 2016


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>(), "");
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22013.62784.patch
Type: text/x-patch
Size: 1469 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160705/a784c100/attachment-0001.bin>


More information about the cfe-commits mailing list