Repository navigation
fix: mixed ImGuiButtonFlags enums rejected by clang in C++26 - #204
Merged
Merged
Conversation
The legend and plot button flags ORed ImGuiButtonFlags_AllowOverlap, from the public ImGuiButtonFlags_ enum, with values from the internal ImGuiButtonFlagsPrivate_ enum. Bitwise operations between different enumeration types are deprecated in C++20 and removed in C++26, so clang++ -std=c++2c now rejects implot3d.cpp with "invalid bitwise operation between different enumeration types", and GCC warns with -Wdeprecated-enum-enum-conversion. Cast the first operand to ImGuiButtonFlags, as ImGui does for its own mixed flags, so the expression is computed as int with the same value as before. The ImPlot3DSpec usage comments in implot3d.h get the same cast so code copied from them stays valid in C++26. This mirrors epezent/implot#710.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The legend and plot button flags OR
ImGuiButtonFlags_AllowOverlap, from ImGui's publicImGuiButtonFlags_enum, with values from the internalImGuiButtonFlagsPrivate_enum. Bitwise operations between different enumeration types are deprecated in C++20 and removed in C++26. As a result,clang++ -std=c++2crejectsimplot3d.cpp("invalid bitwise operation between different enumeration types"), and GCC warns with-Wdeprecated-enum-enum-conversion.Fixed by casting the first operand to
ImGuiButtonFlags, the same style ImGui uses for its own mixed flags. The expression is now computed asintwith the same value, so there is no behavior change. TheImPlot3DSpecusage comments inimplot3d.hget the same cast, so code copied from them stays valid in C++26. Mirrors the same fix in ImPlot (epezent/implot#710).