ned14 / outcome

Provides very lightweight outcome<T> and result<T> (non-Boost edition)
https://ned14.github.io/outcome
Other
675 stars 62 forks source link

warning: the 'bool' keyword is not allowed in a C++20 concept definition #249

Closed basiliscos closed 3 years ago

basiliscos commented 3 years ago

Hi there. Here is a warning which i get using gcc v10.2.1 :

In file included from /home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/basic_result.hpp:35,
                 from /home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/std_result.hpp:34,
                 from /home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/boost_result.hpp:60,
                 from /home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/result.hpp:34,
                 from /home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/outcome.hpp:34,
                 from /home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/iostream_support.hpp:34,
                 from /home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome.hpp:35,
                 from /home/b/development/stheno/./src/Proto/Common.hpp:3,
                 from /home/b/development/stheno/./src/Proto/Backend.hpp:4,
                 from /home/b/development/stheno/tests/Proto/ProtoTest.hpp:2,
                 from /home/b/development/stheno/tests/Proto/ProtoTest.cpp:1:
/home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/convert.hpp:42:41: warning: the 'bool' keyword is not allowed in a C++20 concept definition
   42 | #define BOOST_OUTCOME_GCC6_CONCEPT_BOOL bool
      |                                         ^~~~
/home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/convert.hpp:48:41: note: in expansion of macro 'BOOST_OUTCOME_GCC6_CONCEPT_BOOL'
   48 |     template <class T, class U> concept BOOST_OUTCOME_GCC6_CONCEPT_BOOL SameHelper = std::is_same<T, U>::value;
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/convert.hpp:42:41: warning: the 'bool' keyword is not allowed in a C++20 concept definition
   42 | #define BOOST_OUTCOME_GCC6_CONCEPT_BOOL bool
      |                                         ^~~~
/home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/convert.hpp:49:41: note: in expansion of macro 'BOOST_OUTCOME_GCC6_CONCEPT_BOOL'
   49 |     template <class T, class U> concept BOOST_OUTCOME_GCC6_CONCEPT_BOOL same_as = detail::SameHelper<T, U> &&detail::SameHelper<U, T>;
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/convert.hpp:42:41: warning: the 'bool' keyword is not allowed in a C++20 concept definition
   42 | #define BOOST_OUTCOME_GCC6_CONCEPT_BOOL bool
      |                                         ^~~~
/home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/convert.hpp:50:41: note: in expansion of macro 'BOOST_OUTCOME_GCC6_CONCEPT_BOOL'
   50 |     template <class T, class U> concept BOOST_OUTCOME_GCC6_CONCEPT_BOOL convertible = std::is_convertible<T, U>::value;
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/convert.hpp:42:41: warning: the 'bool' keyword is not allowed in a C++20 concept definition
   42 | #define BOOST_OUTCOME_GCC6_CONCEPT_BOOL bool
      |                                         ^~~~
/home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/convert.hpp:51:41: note: in expansion of macro 'BOOST_OUTCOME_GCC6_CONCEPT_BOOL'
   51 |     template <class T, class U> concept BOOST_OUTCOME_GCC6_CONCEPT_BOOL base_of = std::is_base_of<T, U>::value;
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/convert.hpp:42:41: warning: the 'bool' keyword is not allowed in a C++20 concept definition
   42 | #define BOOST_OUTCOME_GCC6_CONCEPT_BOOL bool
      |                                         ^~~~
/home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/convert.hpp:58:30: note: in expansion of macro 'BOOST_OUTCOME_GCC6_CONCEPT_BOOL'
   58 |   template <class U> concept BOOST_OUTCOME_GCC6_CONCEPT_BOOL value_or_none = requires(U a)
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/convert.hpp:42:41: warning: the 'bool' keyword is not allowed in a C++20 concept definition
   42 | #define BOOST_OUTCOME_GCC6_CONCEPT_BOOL bool
      |                                         ^~~~
/home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/convert.hpp:70:30: note: in expansion of macro 'BOOST_OUTCOME_GCC6_CONCEPT_BOOL'
   70 |   template <class U> concept BOOST_OUTCOME_GCC6_CONCEPT_BOOL value_or_error = requires(U a)
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/convert.hpp:42:41: warning: the 'bool' keyword is not allowed in a C++20 concept definition
   42 | #define BOOST_OUTCOME_GCC6_CONCEPT_BOOL bool
      |                                         ^~~~
/home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/convert.hpp:118:30: note: in expansion of macro 'BOOST_OUTCOME_GCC6_CONCEPT_BOOL'
  118 |   template <class U> concept BOOST_OUTCOME_GCC6_CONCEPT_BOOL ValueOrNone = concepts::value_or_none<U>;
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/convert.hpp:42:41: warning: the 'bool' keyword is not allowed in a C++20 concept definition
   42 | #define BOOST_OUTCOME_GCC6_CONCEPT_BOOL bool
      |                                         ^~~~
/home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/convert.hpp:119:30: note: in expansion of macro 'BOOST_OUTCOME_GCC6_CONCEPT_BOOL'
  119 |   template <class U> concept BOOST_OUTCOME_GCC6_CONCEPT_BOOL ValueOrError = concepts::value_or_error<U>;
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/convert.hpp:42:41: warning: the 'bool' keyword is not allowed in a C++20 concept definition
   42 | #define BOOST_OUTCOME_GCC6_CONCEPT_BOOL bool
      |                                         ^~~~
/home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/basic_result.hpp:182:11: note: in expansion of macro 'BOOST_OUTCOME_GCC6_CONCEPT_BOOL'
  182 |   concept BOOST_OUTCOME_GCC6_CONCEPT_BOOL basic_result =
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/convert.hpp:42:41: warning: the 'bool' keyword is not allowed in a C++20 concept definition
   42 | #define BOOST_OUTCOME_GCC6_CONCEPT_BOOL bool
      |                                         ^~~~
/home/b/.conan/data/boost/1.75.0/_/_/package/52adb4bb3f9b5d3c90032a51831e60e8d2b1381d/include/boost/outcome/basic_outcome.hpp:189:11: note: in expansion of macro 'BOOST_OUTCOME_GCC6_CONCEPT_BOOL'
  189 |   concept BOOST_OUTCOME_GCC6_CONCEPT_BOOL basic_outcome =
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Can it be silenced? Is there any hope, that it will be fixed on the next boost release?

ned14 commented 3 years ago

Was this fixed at https://github.com/ned14/outcome/commit/5d63e610aeefb67f96ef9dec622f178c77e5fa3f#diff-eb070b23ac7b6b7b03d5db9ba664c69e4be28ebb398b3b70ba1ac283b1f498ad?

basiliscos commented 3 years ago

if it was fixed, why it still appears in boost v.1.75 and gcc 10.2?

ned14 commented 3 years ago

It's looking like for --std before 20, one of the GCC 10 series appears to have changed from wanting the legacy concepts syntax to wanting the new concepts syntax. I've had bug reports complaining that GCC 10 didn't work without the logic it currently is, now I have your bug report saying that GCC 10 doesn't work with the current logic.

What we might try is what Chris K does here: https://github.com/chriskohlhoff/asio/blob/master/asio/include/asio/detail/config.hpp#L422. What do you think?

basiliscos commented 3 years ago

Looks better than nothing, if the warnings can be silenced. Will be perfect, if this can be done automatically. )

ned14 commented 3 years ago

Should be fixed now, if the new logic holds. You can check it for yourself at https://github.com/boostorg/outcome/commits/develop. Thanks for the BR!