Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix C++26 invalid enum operation #7954

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

CrackedMatter
Copy link
Contributor

ImGui version: 1.91.1

ImGui fails to compile on C++26 (Clang) with the following error:

imgui_widgets.cpp:5199:62: error: invalid bitwise operation between different enumeration types ('ImGuiItemFlagsPrivate_' and 'ImGuiItemFlags_')
 5199 |         g.NextItemData.ItemFlags |= ImGuiItemFlags_Inputable | ImGuiItemFlags_NoTabStop;
      |                                     ~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~

Adding a cast fixes the error.

Related to #7383.

@ocornut ocornut merged commit 41eebc8 into ocornut:master Sep 5, 2024
6 checks passed
@ocornut
Copy link
Owner

ocornut commented Sep 5, 2024

Thank you. I ought to add this test to my local build scripts.

@CrackedMatter CrackedMatter deleted the c++26-enum-thing-fix branch September 5, 2024 10:09
@ocornut
Copy link
Owner

ocornut commented Sep 5, 2024

FYI I tried the command-line from #7383 (comment) and even with this couldn't trigger the warning.

# clang-cl -v
clang version 17.0.3
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\bin

So even though I have a local build file it doesn't repro this. I assume it might need Clang 19 but that's not avail from VS yet

@nicolasnoble
Copy link
Contributor

Clang-18 is available on Ubuntu 24.04, and I can see clang-19 on debian sid. It might be a good idea to bump and/or add ubuntu 24.04 to the CI, since it's the new LTS, but this wouldn't pick up clang-19 there, and I'm not sure trying to use Debian testing or unstable would be a good idea.

@ocornut
Copy link
Owner

ocornut commented Sep 5, 2024

I upgraded to Ubuntu 24.04 now but it seems GCC there supports up to C++20.
I added a C++20 build to Linux GCC and MacOS Clang, and a C++26 to Linux Clang.

@CrackedMatter
Copy link
Contributor Author

$ ./clang -v
Android (12027248, +pgo, +bolt, +lto, +mlgo, based on r522817) clang version 18.0.1 (https://android.googlesource.com/toolchain/llvm-project d8003a456d14a3deb8054cdaa529ffbf02d9b262)
Target: x86_64-unknown-linux-gnu
Thread model: posix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants