Closed JoeLoser closed 5 years ago
@yfeldblum @Orvid has anyone looked at the remaining Clang 8 compilation issues? It's not obvious to me what the issue(s) are.
I haven't seen these internally. Are these build failures related to using libc++ (clang's c++ std lib) instead of libstdc++ (gcc's c++ std lib)?
I have only tried with clang 8 and libc++. Since internally I believe you're using clang 8 with libstdc++, it's likely a libcpp issue.
Are you able to reproduce it internally when using libc++?
I haven't tried with libc++.
Betting this is related: https://godbolt.org/z/_8vhHg. Possibly libc++'s std::invoke
doesn't handle void
args quite like libstdc++'s in some unknown magical way. Relevant to the definition of ForEachImplTag
, which is using folly::is_invocable
which looks like it should be using folly::invoke
, but which is using std::invoke
because one of the arguments is std::integral_constant
.
I think you're definitely on the right track with the handling of the void
arg. When we change Invoke.h
to always use the backported invoke
rather than std::invoke
for Clang 8 with libc++
, we run into SFINAE errors in invokeForward
(which is SFINAEing on whether the invoke
call is well-formed). This seems different than the trying to form reference to void
.
[449/617] Building CXX object CMakeFiles/partial_test.dir/folly/functional/test/PartialTest.cpp.o
FAILED: CMakeFiles/partial_test.dir/folly/functional/test/PartialTest.cpp.o
/usr/local/Cellar/llvm/8.0.0/bin/clang++ -DFOLLY_XLOG_STRIP_PREFIXES=\"/Users/joe/dev/folly:/Users/joe/dev/folly/_build\" -DGFLAGS_IS_A_DLL=0 -D_GNU_SOURCE -D_REENTRANT -I../ -I. -I/usr/local/boost-1.68.0/include -I/usr/local/Cellar/openssl/1.0.2r/include -isystem /usr/local/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -g -std=gnu++1z -finput-charset=UTF-8 -fsigned-char -Wall -Wno-deprecated -Wno-deprecated-declarations -Wno-sign-compare -Wno-unused -Wunused-label -Wunused-result -Wno-noexcept-type -Wno-nullability-completeness -Wno-inconsistent-missing-override -faligned-new -fopenmp -MD -MT CMakeFiles/partial_test.dir/folly/functional/test/PartialTest.cpp.o -MF CMakeFiles/partial_test.dir/folly/functional/test/PartialTest.cpp.o.d -o CMakeFiles/partial_test.dir/folly/functional/test/PartialTest.cpp.o -c ../folly/functional/test/PartialTest.cpp
../folly/functional/test/PartialTest.cpp:129:17: error: no matching function for call to object of type 'typename remove_reference<Partial<unique_ptr<int, default_delete<int> > (*)(unique_ptr<int, default_delete<int> >, unique_ptr<int,
default_delete<int> >), tuple<unique_ptr<int, default_delete<int> > > > &>::type' (aka 'folly::detail::partial::Partial<std::__1::unique_ptr<int, std::__1::default_delete<int> > (*)(std::__1::unique_ptr<int, std::__1::default_delete<int> >, std::__1::unique_ptr<int, std::__1::default_delete<int> >), std::__1::tuple<std::__1::unique_ptr<int, std::__1::default_delete<int> > > >')
auto result = std::move(p)(std::move(six));
^~~~~~~~~~~~
../folly/functional/Partial.h:58:8: note: candidate function template not viable: no known conversion from 'Partial<...>' to 'Partial<...>' for object argument
auto operator()(CArgs&&... cargs) & -> decltype(invokeForward(
^
../folly/functional/Partial.h:65:8: note: candidate template ignored: substitution failure [with CArgs = <std::__1::unique_ptr<int, std::__1::default_delete<int> >>]: use of undeclared identifier 'invokeForward'
auto operator()(CArgs&&... cargs) const& -> decltype(invokeForward(
^ ~~~~~~~~~~~~~
../folly/functional/Partial.h:72:8: note: candidate template ignored: substitution failure [with As = <std::__1::unique_ptr<int, std::__1::default_delete<int> >>]: use of undeclared identifier 'invokeForward'
auto operator()(As&&... a) && -> decltype(invokeForward(
^ ~~~~~~~~~~~~~
../folly/functional/Partial.h:79:8: note: candidate template ignored: substitution failure [with As = <std::__1::unique_ptr<int, std::__1::default_delete<int> >>]: use of undeclared identifier 'invokeForward'
auto operator()(As&&... as) const&& -> decltype(invokeForward(
^ ~~~~~~~~~~~~~
I would expect this to be fixed with https://github.com/llvm-mirror/libcxx/commit/a32a775e66e7141185ef83ca225cbc4799cb70bf#diff-48f5ee43879b5ad38888f0a6ead10113
Your example doesn't quite work, but the ones below should:
https://wandbox.org/permlink/p0nTOwhj13P6gqyL -> shows failure with Clang 8 and -stdlib=libc++
https://wandbox.org/permlink/8gOgOAF6jqDEuR1V -> shows success with Clang trunk and -stdlib=libc++
I'll check if the Folly code builds fine tomorrow with Clang trunk and libc++
and circle back.
Folly builds fine when I use libc++
trunk, proving this was a libc++
quirk compared to libstdc++
.
In my opinion, it is probably not worth designing a workaround which would only be for Clang 8 and libc++
considering Clang 8.0.1 will come out not too far from now. This issue does not arise when using Clang 7 and libc++
.
In any regard, closing this issue.
With Clang 8 and
libc++
, so far, I have seen at least a few tests (ForeachTest.cpp
line 277 andSynchronizedTest.cpp
).Stack trace for
ForeachTest.cpp
:SynchronizedTest.cpp stack trace:
I have a small patch for
folly/test/SingletonTestStructs.h
which fails due to