Re: [boost] [review] outcome broken on clang/libstdc++ (Linux) and Apple clang/libc++ and gcc 7.2

On Sat, Jan 27, 2018 at 4:55 PM, Glen Fernandes wrote:
I just tried boost-outcome unit tests with clang 4.0, 5.0 on Linux with libstdc++ with -std=c++14 and -std=c++1z which fails with many errors:
e.g. [snip] In file included from libs/outcome/test/tests/../../include/boost/outcome/detail/result_storage.hpp:34: libs/outcome/test/tests/../../include/boost/outcome/detail/../success_failure.hpp:54:42: error: no template named 'conditional_t' in namespace 'std'; did you mean 'conditional'? template <class T> using devoid = std::conditional_t<std::is_void<T>::value, void_type, T>; ~~~~~^~~~~~~~~~~~~ conditional /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/type_traits:1780:12: note: 'conditional' declared here struct conditional ^
Then I also tried the boost-outcome unit tests with Apple clang 8.1.0 with libc++ with -std=c++14 and -std=c++1z which fails with errors like:
I pasted the wrong error output here; the right error output is: clang-darwin.compile.c++ bin.v2/libs/outcome/test/core-outcome.test/clang-darwin-4.2.1/debug/cxxstd-14-iso/tests/core-outcome.o In file included from libs/outcome/test/tests/core-outcome.cpp:30: In file included from libs/outcome/test/tests/../../include/boost/outcome/outcome.hpp:34: In file included from libs/outcome/test/tests/../../include/boost/outcome/detail/outcome_exception_observers.hpp:34: In file included from libs/outcome/test/tests/../../include/boost/outcome/detail/result_storage.hpp:35: libs/outcome/test/tests/../../include/boost/outcome/detail/value_storage.hpp:181:22: error: no matching constructor for initialization of 'value_type' (aka 'boost::outcome_v2::outcome<int, std::__1::error_code, std::exception_ptr, boost::outcome_v2::policy::error_code_throw_as_system_error<int, std::__1::error_code, std::exception_ptr> >') new(&_value) value_type; // NOLINT ^ libs/outcome/test/tests/../../include/boost/outcome/detail/result_storage.hpp:270:11: note: in instantiation of member function 'boost::outcome_v2::detail::value_storage_nontrivial<boost::outcome_v2::outcome<int, std::__1::error_code, std::exception_ptr, boost::outcome_v2::policy::error_code_throw_as_system_error<int, std::__1::error_code, std::exception_ptr> >
::value_storage_nontrivial' requested here : _state(std::move(o._state)) ^
Is this also a known issue? Only gcc 6 and gcc 7 with lisbtdc++ on Linux seem to pass. The other combinations I tried (clang + lisbtdc++ on Linux, Apple clang + libc++) do not.
*)this)->boost::outcome_v2::detail::result_value_observers<boost::outcome_v2::detail::result_storage<int, std::errc, boost::outcome_v2::policy::error_code_throw_as_system_error<int, std::errc, void> >, int, boost::outcome_v2::policy::error_code_throw_as_system_error<int, std::errc, void> ::<anonymous>.boost::outcome_v2::detail::result_storage<int, std::errc, boost::outcome_v2::policy::error_code_throw_as_system_error<int, std::errc, void> ::result_storage<int>(boost::outcome_v2::in_place_type_t<int>(), <anonymous>)’
I spoke too soon, here gcc 7 does not pass. It ICEs: libs/outcome/test/tests/../../include/boost/outcome/detail/result_value_observers.hpp:45:17: in constexpr expansion of ‘((boost::outcome_v2::detail::result_value_observers<boost::outcome_v2::detail::result_storage<int, std::errc, boost::outcome_v2::policy::error_code_throw_as_system_error<int, std::errc, void> >, int, boost::outcome_v2::policy::error_code_throw_as_system_error<int, std::errc, void> libs/outcome/test/tests/core-result.cpp:330:41: internal compiler error: in adjust_temp_type, at cp/constexpr.c:1206 constexpr result<int, std::errc> a(5), b(std::errc::invalid_argument); [...] 0x6db788 cxx_eval_constant_expression ../../src/gcc/cp/constexpr.c:4034 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions. Let me know if you need more context, but it appears boost-outcome is also broken on gcc 7.2. Glen

On 27/01/2018 22:06, Glen Fernandes wrote:
On Sat, Jan 27, 2018 at 4:55 PM, Glen Fernandes wrote:
I just tried boost-outcome unit tests with clang 4.0, 5.0 on Linux with libstdc++ with -std=c++14 and -std=c++1z which fails with many errors:
e.g. [snip] In file included from libs/outcome/test/tests/../../include/boost/outcome/detail/result_storage.hpp:34: libs/outcome/test/tests/../../include/boost/outcome/detail/../success_failure.hpp:54:42: error: no template named 'conditional_t' in namespace 'std'; did you mean 'conditional'? template <class T> using devoid = std::conditional_t<std::is_void<T>::value, void_type, T>; ~~~~~^~~~~~~~~~~~~ conditional /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/type_traits:1780:12: note: 'conditional' declared here struct conditional
That's an ancient version of libstdc++ 4.8 which does not provide sufficient C++ 14 support. As the documentation says at https://ned14.github.io/outcome/requirements/, you need GCC 6.3 or later. Thus libstdc++ would also need to be 6.3 or newer.
Then I also tried the boost-outcome unit tests with Apple clang 8.1.0 with libc++ with -std=c++14 and -std=c++1z which fails with errors like:
Again, as https://ned14.github.io/outcome/requirements/ says, XCode 9 or newer is required. The implementation of C++ 14 in XCode 8 is insufficient.
Is this also a known issue? Only gcc 6 and gcc 7 with lisbtdc++ on Linux seem to pass. The other combinations I tried (clang + lisbtdc++ on Linux, Apple clang + libc++) do not.
I spoke too soon, here gcc 7 does not pass. It ICEs: [snip] Let me know if you need more context, but it appears boost-outcome is also broken on gcc 7.2.
There's a long standing memory corruption bug in GCC's constexpr implementation which Outcome's unit tests may trigger sometimes. The GCC maintainers know well of this bug, and efforts continue to track it down and fix it. The problem is that it is not repeatable across machines. I may get consistently an ICE here on my machine (I do!), but Travis running the exact same compiler and test suite does not (also true!). Same problem when say Jason Merrill runs a repro I send him, and it works perfectly on his machine, yet ICEs on mine. If you're using Outcome heavily in 100% constexpr programming, then you are advised to use clang or - and I kid you not here - MSVC until GCC gets its constexpr implementation fixed. Again, none of this is Outcome's fault. These are bugs in compilers. I would also add that in day to day programming, GCC's constexpr problems don't really manifest. They appear only when heavily stressed in say a test suite which runs lots of corner case scenarios that would never happen in real life. Equally, if when programming with Outcome and you see GCC ICEing in constexpr, either remove the constexpr or use a different compiler. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
participants (2)
-
Glen Fernandes
-
Niall Douglas