Skip to content

Conversation

@bigerl
Copy link
Contributor

@bigerl bigerl commented May 21, 2022

After upgrading to libstdc++-12 I ran into an error with expected-lite.

/home/xxx/.conan/data/expected-lite/0.5.0/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/nonstd/expected.hpp:208:16: error: no member named 'expected' in namespace 'std'; did you mean 'unexpected'?
    using std::expected;
          ~~~~~^
/usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/exception:109:8: note: 'unexpected' declared here
  void unexpected() __attribute__ ((__noreturn__));

I guess the code in expected-lite was written under the assumption that std::expected would be included into C++20 standard. However, it was not and will likely be added in C++23. libstdc++-12 seems to be among the first to implement it and activates it when compiling with C++23.
When compiling as C++20 with g++-12, the macro #if nsel_CPP20_OR_GREATER && defined(__has_include ) is activated, although it shoudn't.

The expected header of libsdc++-12 uses the following macro to deactivate std::expected for C++ <20:

#if __cplusplus > 202002L && __cpp_concepts >= 202002L

Note: it uses > not <=

This 3-line patch should do the trick for me.

@martinmoene
Copy link
Collaborator

Thanks!

Hope to be able to have look at Conan within a few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants