You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
C++20: -Wambiguous-reversed-operator on TColorPalette::operator== (colorutils.h:486) — make hidden friend or add operator!= #2724
C++20 -Wambiguous-reversed-operator fires on CRGBPalette16 == CRGBPalette16 because the class defines a member operator== and C++20 synthesizes a reversed candidate, leading to an ambiguous best-viable-function diagnosis at every call site.
warning: ISO C++20 considers use of overloaded operator == (with operand types
CRGBPalette16 and CRGBPalette16) to be ambiguous despite there being a unique
best viable function [-Wambiguous-reversed-operator]
defining op: src/fl/gfx/colorutils.h:486
call site: src/fl/fx/2d/noisepalette.h:78 -> do { ... } while (newPalette == currentPalette);
Root cause: CRGBPalette16 brings in Base::operator== via using, and the reverse-order resolution becomes ambiguous under C++20.
Why this matters
Affects every C++20 build (wasm, wasm_compile_test today; the rest of the matrix will inherit it as toolchains default to -std=gnu++20). Will silently change to a compile error when fbuild upgrades the wasm toolchain to a stricter C++20 mode.
Proposed fix
Two clean options:
Add explicit bool operator==(const CRGBPalette16&) const = default; on CRGBPalette16.
Make operator== a hidden friend (non-member declared inside the class body) — recommended C++20 idiom:
friendbooloperator==(const TColorPalette& a, const TColorPalette& b) { ... }
The friend form is the most future-proof.
Evidence
wasm + wasm_compile_test runs surface this on every TU that includes fl/fx/2d/noisepalette.h.
Activity
zackees commentedon Jun 4, 2026
Tracked under fbuild meta-audit: FastLED/fbuild#408
fix(palette): convert TColorPalette::operator==/!= to hidden friends (#…
fix(hsv): compare CHSV by field instead of by its RGB rendering (#691) (
fix(pixelset): const-qualify size() and let iterators compare a tempo…