Skip to content

fix: mixed ImGuiButtonFlags enums rejected by clang in C++26 - #204

Merged
brenocq merged 1 commit into
mainfrom
fix/enum-arithmetic-conversions
Oct 25, 2026
Merged

brenocq merged 1 commit into
mainfrom
fix/enum-arithmetic-conversions

Conversation

@brenocq

@brenocq brenocq commented Oct 25, 2026

Copy link
Copy Markdown
Owner

The legend and plot button flags OR ImGuiButtonFlags_AllowOverlap, from ImGui's 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. As a result, clang++ -std=c++2c rejects implot3d.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 as int with the same value, so there is no behavior change. The ImPlot3DSpec usage comments in implot3d.h get the same cast, so code copied from them stays valid in C++26. Mirrors the same fix in ImPlot (epezent/implot#710).

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.
@brenocq brenocq added type:fix Something isn't working prio:medium Medium priority status:review The task is under review labels Oct 25, 2026
@brenocq brenocq self-assigned this Oct 25, 2026
@brenocq
brenocq merged commit 718b6e8 into main Oct 25, 2026
10 checks passed
@brenocq
brenocq deleted the fix/enum-arithmetic-conversions branch October 25, 2026 14:34
@github-actions github-actions Bot added status:done Task completed successfully and removed status:review The task is under review labels Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

prio:medium Medium priority status:done Task completed successfully type:fix Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant