This patch optimizes the compilation performance of std::is_invocable
by dispatching to the new __is_invocable built-in trait.
libstdc++-v3/ChangeLog:
* include/std/type_traits (is_invocable): Use __is_invocable
built-in trait.
* testsuite/20_util/is_invocable/incomplete_args_neg.cc: Handle
the new error from __is_invocable.
* testsuite/20_util/is_invocable/incomplete_neg.cc: Likewise.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
libstdc++-v3/include/std/type_traits | 6 ++++++
.../testsuite/20_util/is_invocable/incomplete_args_neg.cc | 1 +
.../testsuite/20_util/is_invocable/incomplete_neg.cc | 1 +
3 files changed, 8 insertions(+)
@@ -3167,9 +3167,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using invoke_result_t = typename invoke_result<_Fn, _Args...>::type;
/// std::is_invocable
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_invocable)
+ template<typename _Fn, typename... _ArgTypes>
+ struct is_invocable
+ : public __bool_constant<__is_invocable(_Fn, _ArgTypes...)>
+#else
template<typename _Fn, typename... _ArgTypes>
struct is_invocable
: __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>::type
+#endif
{
static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
"_Fn must be a complete class or an unbounded array");
@@ -18,6 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-error "must be a complete class" "" { target *-*-* } 0 }
+// { dg-prune-output "invalid use of incomplete type" }
#include <type_traits>
@@ -18,6 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-error "must be a complete class" "" { target *-*-* } 0 }
+// { dg-prune-output "invalid use of incomplete type" }
#include <type_traits>