Open rbrugo opened 4 years ago
If I try to compile tests, GCC gives me this output:
[rbrugo@rbrugo ~/git/lift/build] (master) $ cmake .. && cmake --build . -- The C compiler identification is GNU 9.2.0 -- The CXX compiler identification is GNU 9.2.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /home/rbrugo/git/lift/build Scanning dependencies of target self_test [ 33%] Building CXX object test/CMakeFiles/self_test.dir/tests.cpp.o /home/rbrugo/git/lift/test/tests.cpp:40:37: error: non-constant condition for static assertion 39 | static_assert(lift::when_none(eq<3>, | ~~~~~~~~~~~~~~~~~~~~~~ 40 | eq<4>)(5), | ~~~~~~^~~ /home/rbrugo/git/lift/test/tests.cpp:41:40: in ‘constexpr’ expansion of ‘lift::when_none(Fs&& ...) [with Fs = {const lift::equal(T&&) [with T = int]::<lambda(const auto:3&)>&, const lift::equal(T&&) [with T = int]::<lambda(const auto:3&)>&}](eq<4>)’ /home/rbrugo/git/lift/test/tests.cpp:41:40: in ‘constexpr’ expansion of ‘lift::negate(F&&) [with F = lift::when_any(Fs&& ...) [with Fs = {const lift::equal(T&&) [with T = int]::<lambda(const auto:3&)>&, const lift::equal(T&&) [with T = int]::<lambda(const auto:3&)>&}]::<lambda(const auto:10& ...)>]()’ /home/rbrugo/git/lift/test/tests.cpp:40:37: error: call to non-‘constexpr’ function ‘lift::when_any(Fs&& ...) [with Fs = {const lift::equal(T&&) [with T = int]::<lambda(const auto:3&)>&, const lift::equal(T&&) [with T = int]::<lambda(const auto:3&)>&}]::<lambda(const auto:10& ...)>::<lambda>(lift::when_any(Fs&& ...) [with Fs = {const lift::equal(T&&) [with T = int]::<lambda(const auto:3&)>&, const lift::equal(T&&) [with T = int]::<lambda(const auto:3&)>&}]::<lambda(const auto:10& ...)>&&)’ In file included from /home/rbrugo/git/lift/test/tests.cpp:14: /home/rbrugo/git/lift/include/lift.hpp:270:5: note: ‘lift::when_any(Fs&& ...) [with Fs = {const lift::equal(T&&) [with T = int]::<lambda(const auto:3&)>&, const lift::equal(T&&) [with T = int]::<lambda(const auto:3&)>&}]::<lambda(const auto:10& ...)>::<lambda>(lift::when_any(Fs&& ...) [with Fs = {const lift::equal(T&&) [with T = int]::<lambda(const auto:3&)>&, const lift::equal(T&&) [with T = int]::<lambda(const auto:3&)>&}]::<lambda(const auto:10& ...)>&&)’ is not usable as a ‘constexpr’ function because: 270 | [funcs = std::tuple(std::forward<Fs>(fs)...)] | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 271 | (const auto& ... obj) | ~~~~~~~~~~~~~~~~~~~~~ 272 | noexcept(noexcept((std::forward<Fs>(fs)(obj...) || ...))) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 273 | -> bool | ~~~~~~~ 274 | { | ~ 275 | return detail::when_any( | ~~~~~~~~~~~~~~~~~~~~~~~~ 276 | funcs, | ~~~~~~ 277 | std::index_sequence_for<Fs...>{}, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 278 | obj... | ~~~~~~ 279 | ); | ~~ 280 | }; | ~ /home/rbrugo/git/lift/include/lift.hpp:270: confused by earlier errors, bailing out make[2]: *** [test/CMakeFiles/self_test.dir/build.make:63: test/CMakeFiles/self_test.dir/tests.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:94: test/CMakeFiles/self_test.dir/all] Error 2 make: *** [Makefile:84: all] Error 2
OK, it seems like I have yet a compiler bug report to write. gcc-7 handles it, and so does gcc-trunk. Clang 6 and later all handles it.
https://godbolt.org/z/ibXJq8
If I try to compile tests, GCC gives me this output: