[llvm-bugs] [Bug 42732] New: is_invocable hard errors on functions returning indestructible types by value

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 23 21:40:08 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42732

            Bug ID: 42732
           Summary: is_invocable hard errors on functions returning
                    indestructible types by value
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Standards Issues
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rs2740 at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

Repro:

#include <type_traits>

struct S { friend struct F; protected: ~S(); };
struct F { S operator()() { return {}; } };

static_assert(!std::is_invocable_v<F>);


/opt/compiler-explorer/clang-trunk-20190722/bin/../include/c++/v1/type_traits:3530:23:
error: temporary of type 'S' has protected destructor

_LIBCPP_INVOKE_RETURN(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...))

                      ^

/opt/compiler-explorer/clang-trunk-20190722/bin/../include/c++/v1/__config:758:15:
note: expanded from macro '_VSTD'

#define _VSTD std::_LIBCPP_ABI_NAMESPACE

              ^

/opt/compiler-explorer/clang-trunk-20190722/bin/../include/c++/v1/type_traits:3546:5:
note: in instantiation of exception specification for '__invoke<F>' requested
here

    _VSTD::__invoke(_VSTD::declval<_XFp>(), _VSTD::declval<_XArgs>()...));

    ^

/opt/compiler-explorer/clang-trunk-20190722/bin/../include/c++/v1/__config:758:15:
note: expanded from macro '_VSTD'

#define _VSTD std::_LIBCPP_ABI_NAMESPACE

              ^

/opt/compiler-explorer/clang-trunk-20190722/bin/../include/c++/v1/type_traits:3552:28:
note: while substituting deduced template arguments into function template
'__try_call' [with _XFp = F, _XArgs = (no value)]

  using _Result = decltype(__try_call<_Fp, _Args...>(0));

                           ^

/opt/compiler-explorer/clang-trunk-20190722/bin/../include/c++/v1/type_traits:3645:31:
note: in instantiation of template class 'std::__1::__invokable_r<void, F>'
requested here

    : integral_constant<bool, __invokable<_Fn, _Args...>::value> {};

                              ^

/opt/compiler-explorer/clang-trunk-20190722/bin/../include/c++/v1/type_traits:3653:7:
note: in instantiation of template class 'std::__1::is_invocable<F>' requested
here

    = is_invocable<_Fn, _Args...>::value;

      ^

<source>:6:21: note: in instantiation of variable template specialization
'std::__1::is_invocable_v<F>' requested here

static_assert(!std::is_invocable_v<F>); // fires

                    ^

<source>:3:40: note: declared protected here

struct S { friend struct F; protected: ~S(); };

                                       ^

<source>:6:1: error: static_assert failed due to requirement
'!std::is_invocable_v<F>'

static_assert(!std::is_invocable_v<F>); // fires

^             ~~~~~~~~~~~~~~~~~~~~~~~

I think this case should be false (the INVOKE expression is not well-formed
when treated as an unevaluated operand), but regardless a hard error is
uncalled for.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190724/36243df6/attachment.html>


More information about the llvm-bugs mailing list