Repository navigation
Remove deprecated arithmetic conversions on enums - #710
Conversation
This is completely removed in C++26. Suppressing warnings is not enough, and is a hard error on clang-cl with -std=c++latest.
|
I noticed #689 cites a commit where the warning was suppressed instead of changing the code, but even then before that PR was made, a different ImGui commit was made where the code was changed, so this PR actually keeps things more in-line with how ImGui does things. |
The demo combined ImPlotItemFlags_NoLegend with ImPlotLineFlags_Shaded directly, a bitwise operation between two enumeration types that C++20 deprecates and C++26 removes. GCC warned about it with -Wdeprecated-enum-enum-conversion and Clang only stayed quiet because of the file-level pragmas, which also silence the C++26 error. Cast the first operand to ImPlotItemFlags, the style ImGui uses for its own mixed flags, and drop the now unneeded Clang pragmas from the demo. The ImPlotSpec usage comments in implot.h get the same cast so code copied from them stays valid in C++26.
|
Thanks @Gold856, fixing the code instead of silencing the warning is the right call, and it matches what ImGui does. I merged master into the branch and added a commit that applies the same cast in two more places. The first is the demo, at the two To test it, I built I couldn't reproduce the clang-cl error because I don't have a Windows SDK here. A Linux-target |
This is completely removed in C++26. Suppressing warnings is not enough, and is a hard error on clang-cl with -std=c++latest.