outcome icon indicating copy to clipboard operation
outcome copied to clipboard

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

Open talisein opened this issue 1 year ago • 1 comments

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...

talisein avatar May 30 '24 15:05 talisein

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.

ned14 avatar May 31 '24 13:05 ned14

This should now be fixed. Thanks for the BR!

ned14 avatar Jul 17 '24 14:07 ned14