[PATCH] D88977: Reapply [ADT] function_ref's constructor is unavailable if the argument is not callable.

James Nagurne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 14 14:17:54 PDT 2020


JamesNagurne added a comment.

I believe our teams' downstream Darwin (cross compiler to ARM) builds are failing due to this commit:

Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.7.0
Thread model: posix

Cutdown: https://godbolt.org/z/dePeze

  In file included from bla.cpp:2:
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/type_traits:4039:19: error: 
        invalid application of 'sizeof' to a function type
      static_assert(sizeof(_Tp) > 0, "Type must be complete.");
                    ^~~~~~~~~~~
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/type_traits:4044:15: note: 
        in instantiation of template class 'std::__1::__check_complete<void ()
        __attribute__((noreturn))>' requested here
      : private __check_complete<_Tp>
                ^
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/type_traits:4337:15: note: 
        in instantiation of template class 'std::__1::__check_complete<void (&)()
        __attribute__((noreturn))>' requested here
      : private __check_complete<_Fp>
                ^
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/type_traits:4392:9: note: 
        in instantiation of template class 'std::__1::__invokable_r<void, void (&)()
        __attribute__((noreturn))>' requested here
          __invokable<_Fp, _Args...>::value,
          ^
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/type_traits:4401:14: note: 
        in instantiation of template class 'std::__1::__invoke_of<void (&)()
        __attribute__((noreturn))>' requested here
      : public __invoke_of<_Fp, _Args...>
               ^
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/type_traits:4406:22: note: 
        in instantiation of template class 'std::__1::result_of<void (&())()
        __attribute__((noreturn))>' requested here
  template <class _Tp> using result_of_t = typename result_of<_Tp>::type;
                       ^
  bla.cpp:33:33: note: in instantiation of template type alias 'result_of_t' requested here
                             std::result_of_t<Callable(Params...)>, Ret>::value>
                                  ^
  bla.cpp:51:13: note: while substituting deduced template arguments into function template
        'function_ref' [with Callable = void (&)() __attribute__((noreturn))]
      myY.foo(abort);
              ^
  1 error generated.

  > cat /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__libcpp_version
  5000

This error seems to be caused by using a libcxx implementation from before monorepo commit 11a18a79 (2018-05-10), which removes the implementation of "check_complete". The problem is that in the implementation of "check_complete", which is used to determine if a type is invokable, which in turn is used to define result_of, there sits a sizeof check, which is illegal on function types.
Hopefully someone more knowledgeable on the support model of the llvm source can chime in. Do we need to upgrade our libc++ implementation, or is this commit intended to work with this version?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88977/new/

https://reviews.llvm.org/D88977



More information about the llvm-commits mailing list