test_containers.cpp: error: > value computed is not used [-Werror=unused-value]
MarkAtBosch opened this issue · comments
Hi,
When compiling magic_enum 0.9.5 using g++ 14.1.0 from OpenEmbedded (Yocto Project) for the qemuarm machine (32 bit Cortex-A9 T2HF Neon) one runs into the following error.
lib32-magic-enum/0.9.5/git/test/test_containers.cpp:290:89: error:
value computed is not used [-Werror=unused-value]
290 | magic_enum::containers::set color_set_not_const {Color::RED, Color::GREEN, Color::BLUE}; |
The problem does not show up when we tried g++ 11.4.
Our proposal to mitigate the problem is to change the line
magic_enum::containers::set color_set_not_const {Color::RED, Color::GREEN, Color::BLUE};
by adding an assignment operator, like it is done some lines above as well.
magic_enum::containers::set color_set_not_const = {Color::RED, Color::GREEN, Color::BLUE};
What do you think? Could that be a fix in your repository?
As a reference, please see the exchange on the OE mailing list.
https://lists.openembedded.org/g/openembedded-devel/topic/meta_oe_patch_magic_enum/106757432
Cheers,
Mark
We had a deeper look at this and came to the conclusion that it is very likely a compiler bug. Here, you'll find a matching bug report:
https://gcc.gnu.org/bugzilla/show_bug.cgi?format=multiple&id=114970
We were also able to reproduce the problem on https://godbolt.org/. The magic_enum_containers.hpp plus the offending test line compiles nicely with gcc ARM 13.3.0 but fails with gcc ARM 14.1.0.
@Neargye What could be done next?
Thanks for the investigation
Fix it in master, could you please check? If everything is ok, I will prepare a release
Thanks for the investigation Fix it in master, could you please check? If everything is ok, I will prepare a release
Yes, the fix on master resolves this problem. Thank you.