ImVec2: added a check for cases where a custom IM_VEC2_CLASS_EXTRA macro adds an extra operator= to ImVec2

This commit is contained in:
ocornut 2026-10-15 17:56:20 +02:00
parent f5d2b7dd01
commit c7d17f01cd
2 changed files with 16 additions and 3 deletions

View File

@ -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)

View File

@ -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__