<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - is_invocable hard errors on functions returning indestructible types by value"
   href="https://bugs.llvm.org/show_bug.cgi?id=42732">42732</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>is_invocable hard errors on functions returning indestructible types by value
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Standards Issues
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>rs2740@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>