Can't build with C++26 due to removed deprecated arithmetic conversion on enumerations #7088

Closed
opened 2023-12-04 13:58:26 +00:00 by JohelEGP · 0 comments
JohelEGP commented 2023-12-04 13:58:26 +00:00 (Migrated from github.com)

Version/Branch of Dear ImGui: Commit 52886872f1.

Back-end/Renderer/Compiler/OS

Back-ends: N/A.
Compiler: Clang 18, possibly GCC 14.
Operating System: N/A.

Issue:

C++26 will include "Removing deprecated arithmetic conversion on enumerations".
The listed compilers already implement those (https://en.cppreference.com/w/cpp/compiler_support#C.2B.2B26_features):

C++26 feature Paper(s) GCC Clang MSVC Apple Clang
Removing deprecated arithmetic conversion on enumerations P2864R2 14 18

Reproduction:

While building imgui_widgets.cpp:

/home/johel/Documents/C++/Forks/imgui/imgui_widgets.cpp:1682:55: error: invalid bitwise operation between different enumeration types ('ImGuiComboFlags_' and 'ImGuiComboFlagsPrivate_')
 1682 |         IM_ASSERT((flags & (ImGuiComboFlags_NoPreview | ImGuiComboFlags_CustomPreview)) == 0);
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/imgui/imgui.h:84:44: note: expanded from macro 'IM_ASSERT'
   84 | #define IM_ASSERT(_EXPR)            assert(_EXPR)                               // You can override the default assert handler by editing imconfig.h
      |                                            ^~~~~
/usr/include/assert.h:100:27: note: expanded from macro 'assert'
  100 |      (static_cast <bool> (expr)                                         \
      |                           ^~~~
/home/johel/Documents/C++/Forks/imgui/imgui_widgets.cpp:3429:67: error: invalid bitwise operation between different enumeration types ('ImGuiInputTextFlags_' and 'ImGuiInputTextFlagsPrivate_')
 3429 |     ImGuiInputTextFlags flags = ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_NoMarkEdited;
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/imgui/imgui_widgets.cpp:3477:48: error: invalid bitwise operation between different enumeration types ('ImGuiInputTextFlags_' and 'ImGuiInputTextFlagsPrivate_')
 3477 |     flags |= ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_NoMarkEdited; // We call MarkItemEdited() ourselves by comparing the actual data rather than the string.
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/johel/Documents/C++/Forks/imgui/imgui_widgets.cpp:6472:50: error: invalid bitwise operation between different enumeration types ('ImGuiTreeNodeFlags_' and 'ImGuiTreeNodeFlagsPrivate_')
 6472 |         flags |= ImGuiTreeNodeFlags_AllowOverlap | ImGuiTreeNodeFlags_ClipLabelForTrailingButton;
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 errors generated.
**Version/Branch of Dear ImGui:** Commit 52886872f10656b299af4b90487e1036f582b812. **Back-end/Renderer/Compiler/OS** Back-ends: N/A. Compiler: Clang 18, possibly GCC 14. Operating System: N/A. **Issue:** C++26 will include "Removing deprecated arithmetic conversion on enumerations". The listed compilers already implement those (<https://en.cppreference.com/w/cpp/compiler_support#C.2B.2B26_features>): C++26 feature | Paper(s) | GCC | Clang | MSVC | Apple Clang -- | -- | -- | -- | -- | -- Removing deprecated arithmetic conversion on enumerations | [P2864R2](https://wg21.link/P2864R2) | 14 | 18 | | | **Reproduction:** While building `imgui_widgets.cpp`: ``` /home/johel/Documents/C++/Forks/imgui/imgui_widgets.cpp:1682:55: error: invalid bitwise operation between different enumeration types ('ImGuiComboFlags_' and 'ImGuiComboFlagsPrivate_') 1682 | IM_ASSERT((flags & (ImGuiComboFlags_NoPreview | ImGuiComboFlags_CustomPreview)) == 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/johel/Documents/C++/Forks/imgui/imgui.h:84:44: note: expanded from macro 'IM_ASSERT' 84 | #define IM_ASSERT(_EXPR) assert(_EXPR) // You can override the default assert handler by editing imconfig.h | ^~~~~ /usr/include/assert.h:100:27: note: expanded from macro 'assert' 100 | (static_cast <bool> (expr) \ | ^~~~ /home/johel/Documents/C++/Forks/imgui/imgui_widgets.cpp:3429:67: error: invalid bitwise operation between different enumeration types ('ImGuiInputTextFlags_' and 'ImGuiInputTextFlagsPrivate_') 3429 | ImGuiInputTextFlags flags = ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_NoMarkEdited; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/johel/Documents/C++/Forks/imgui/imgui_widgets.cpp:3477:48: error: invalid bitwise operation between different enumeration types ('ImGuiInputTextFlags_' and 'ImGuiInputTextFlagsPrivate_') 3477 | flags |= ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_NoMarkEdited; // We call MarkItemEdited() ourselves by comparing the actual data rather than the string. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/johel/Documents/C++/Forks/imgui/imgui_widgets.cpp:6472:50: error: invalid bitwise operation between different enumeration types ('ImGuiTreeNodeFlags_' and 'ImGuiTreeNodeFlagsPrivate_') 6472 | flags |= ImGuiTreeNodeFlags_AllowOverlap | ImGuiTreeNodeFlags_ClipLabelForTrailingButton; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 errors generated. ```
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#7088
No description provided.