From c7d17f01cd3e14bbc9b33cee44e0a2d6f3a2a524 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 15 Oct 2026 17:56:20 +0200 Subject: [PATCH] ImVec2: added a check for cases where a custom `IM_VEC2_CLASS_EXTRA` macro adds an extra `operator=` to ImVec2 --- docs/CHANGELOG.txt | 10 +++++++--- imgui.cpp | 9 +++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 50b16b595..0576968ca 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -59,13 +59,17 @@ Autumn cleanup of stuff marked obsolete more than two years ago: - `io.GetClipboardTextFn` --> `platform_io.Platform_GetClipboardTextFn` - `io.SetClipboardTextFn` --> `platform_io.Platform_SetClipboardTextFn` - `io.ClipboardUserData` --> `platform_io.Platform_ClipboardUserData` - -Please also try to get rid of calls to `GetContentRegionMax()`, `GetWindowContentRegionMin()` -and `GetWindowContentRegionMax()`: you do NOT need those functions. See #7838. +- Please also try to get rid of calls to `GetContentRegionMax()`, `GetWindowContentRegionMin()` + and `GetWindowContentRegionMax()` will may be removed soon-ish: you should not + ever need those functions. See #7838. Other Changes: +- ImVec2: added a check for cases where a custom `IM_VEC2_CLASS_EXTRA` macro + adds an extra `operator=` to ImVec2. This isn't supported but should not + be needed as you should have a constructor to convert from your type to ImVec2. + ----------------------------------------------------------------------- VERSION 1.93.0 (Released 2026-10-14) diff --git a/imgui.cpp b/imgui.cpp index 256486f6b..a970e92ca 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -11208,6 +11208,15 @@ static void ImGui::ErrorCheckNewFrameSanityChecks() // #define IM_ASSERT(EXPR) do { if (SomeCode(EXPR)) SomeMoreCode(); } while (0) // Correct! if (true) IM_ASSERT(1); else IM_ASSERT(0); + // Check user IM_VEC2_CLASS_EXTRA macro + // (IF YOU GET A "ambiguous overload" COMPILE ERROR HERE: does your IM_VEC2_CLASS_EXTRA macro contains an operator=? + // e.g. ImVec2& operator=(const MyPoint & p) { x = p.x; y = p.y; return *this; } + // You should be able to remove it if you have the corresponding constructor: + // e.g. IM_NODEBUGSTEP constexpr inline ImVec2(const MyPoint& f) : x(f.x), y(f.y) {} + // Allowing you to add this extra operator to ImVec2 would prevent our whole codebase from using v = {x,y} assignment style. + // PLEASE GET IN TOUCH IF REMOVING THE operator= IS A PROBLEM TO YOU) + ImVec2 v; v = { 1.0f, 2.0f }; + // Emscripten backends are often imprecise in their submission of DeltaTime. (#6114, #3644) // Ideally the Emscripten app/backend should aim to fix or smooth this value and avoid feeding zero, but we tolerate it. #ifdef __EMSCRIPTEN__