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

gcc 14.1.1 warns on use of '_' name when -std < c++26 #299

Open talisein opened 1 month ago

talisein commented 1 month ago

Using Fedora 40, gcc (GCC) 14.1.1 20240522 (Red Hat 14.1.1-4), the following warning issues:

In file included from ../subprojects/outcome/include/outcome/detail/basic_result_storage.hpp:30,
                 from ../subprojects/outcome/include/outcome/convert.hpp:28,
                 from ../subprojects/outcome/include/outcome/basic_result.hpp:29,
                 from ../subprojects/outcome/include/outcome/std_result.hpp:28,
                 from ../subprojects/outcome/include/outcome/result.hpp:28,
                 from ../src/main.cpp:12:
../subprojects/outcome/include/outcome/detail/value_storage.hpp: In member function ‘constexpr void outcome_v2::detail::value_storage_nontrivial<T, E>::swap(outcome_v2::detail::value_storage_nontrivial<T, E>&)’:
../subprojects/outcome/include/outcome/detail/value_storage.hpp:1298:11: warning: name-independent declarations only available with ‘-std=c++2c’ or ‘-std=gnu++2c’ [-Wc++26-extensions]
 1298 |         } _{_status, o._status};
      |           ^
../subprojects/outcome/include/outcome/detail/value_storage.hpp:1319:11: warning: name-independent declarations only available with ‘-std=c++2c’ or ‘-std=gnu++2c’ [-Wc++26-extensions]
 1319 |         } _{_status, o._status};
      |           ^
../subprojects/outcome/include/outcome/detail/value_storage.hpp:1385:9: warning: name-independent declarations only available with ‘-std=c++2c’ or ‘-std=gnu++2c’ [-Wc++26-extensions]
 1385 |       } _{_status, o._status, OUTCOME_ADDRESS_OF(_value), OUTCOME_ADDRESS_OF(o._value), OUTCOME_ADDRESS_OF(_error), OUTCOME_ADDRESS_OF(o._error)};
      |         ^

Presumably due to P2169. Personally I think its regrettable for gcc to warn about this, but...

ned14 commented 1 month ago

Hang on, so it's complaining about the use of a name which is meant to be name independent, and would remain so post-26?

Well that is just plain irritating. Thanks for letting me know.