Skip to content

fix(palette): explicit Rule of 5 on detail::TCRGBPalette<N> (#2725) - #2736

Merged
zackees merged 1 commit into
masterfrom
fix/2725-tcrgbpalette-rule-of-5
Jun 4, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/2725-tcrgbpalette-rule-of-5

Conversation

@zackees

@zackees zackees commented Jun 4, 2026 •

Copy link
Copy Markdown
Member

Closes #2725.

Summary

-Wdeprecated-copy fires on TCRGBPalette<16>::operator= because the class declares user-defined conversion ctors / assignment operators (taking TColorPalette<CHSV, Size> or const CHSV(&)[Size]) without also explicitly declaring the same-type copy ctor / copy assign / dtor. C++11+ deprecates relying on the implicit copy-assignment in that case; ~472 hits across teensy30/31/40/41/LC builds.

Fix

Add explicit = default declarations for the Rule of 5 on detail::TCRGBPalette<N>:

TCRGBPalette(const TCRGBPalette&) FL_NOEXCEPT = default;
TCRGBPalette& operator=(const TCRGBPalette&) FL_NOEXCEPT = default;
~TCRGBPalette() FL_NOEXCEPT = default;

Mirrors what CRGBPalette16 (colorutils.h:707-709), CRGBPalette32, CRGBPalette256, CHSVPalette16/32/256 already do at the derived level. The base TColorPalette is fine — it explicitly declares its own copy ctor + copy assign with bodies.

Test plan

  • bash lint clean
  • bash test fl_gfx_colorutils --cpp passes
  • CI green on teensy30/31/40/41/LC (where -Wdeprecated-copy fires)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Improved internal code quality and standards compliance for color palette handling.

`-Wdeprecated-copy` fires on `TCRGBPalette<16>::operator=` because the
class declares user-defined conversion ctors / assignment operators
(taking `TColorPalette<CHSV, Size>` or `const CHSV(&)[Size]`) without
also explicitly declaring the same-type copy ctor / copy assign / dtor.
C++11+ deprecates relying on the implicit copy-assignment in that case;
~472 hits across teensy30/31/40/41/LC.

Fix: add explicit `= default` declarations for the Rule of 5 on
`detail::TCRGBPalette<N>`. Mirrors what `CRGBPalette16`,
`CRGBPalette32`, `CRGBPalette256`, `CHSVPalette16/32/256` already do at
the derived level.

Closes #2725.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 4, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c8e45b65-0c1d-4e90-89c2-2685a8d16fb9

📥 Commits

Reviewing files that changed from the base of the PR and between ae6785b and 2065a9e.

📒 Files selected for processing (1)
  • src/fl/gfx/colorutils.h

📝 Walkthrough

Walkthrough

The PR adds explicit defaulted declarations of the copy constructor, copy assignment operator, and destructor to detail::TCRGBPalette template in src/fl/gfx/colorutils.h (lines 526–533), each marked FL_NOEXCEPT. This addresses C++11+ deprecation warnings triggered by implicit special member generation.

Changes

TCRGBPalette special members

Layer / File(s) Summary
Explicit default special members for TCRGBPalette
src/fl/gfx/colorutils.h
Copy constructor, copy assignment operator, and destructor explicitly defaulted with FL_NOEXCEPT annotations to enforce Rule of 5 and suppress -Wdeprecated-copy warnings, mirroring existing CRGBPalette16 declarations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A template once shy with implicit rules,
now speaks its mind: default is cool.
Five special members, declared and true,
No warnings cry—Rule of 5, we're through! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: explicitly implementing the Rule of 5 special members in detail::TCRGBPalette to fix compiler warnings.
Linked Issues check ✅ Passed The changes fully implement the proposed fix from issue #2725 by explicitly declaring and defaulting the copy constructor, copy assignment operator, and destructor with FL_NOEXCEPT, eliminating -Wdeprecated-copy warnings.
Out of Scope Changes check ✅ Passed All changes are directly scoped to addressing the Rule of 5 violation in detail::TCRGBPalette as specified in issue #2725; no unrelated modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/2725-tcrgbpalette-rule-of-5

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zackees
zackees merged commit a5342dc into master Jun 4, 2026
8 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jun 4, 2026
@zackees
zackees deleted the fix/2725-tcrgbpalette-rule-of-5 branch August 21, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

-Wdeprecated-copy on TCRGBPalette<16>::operator= (colorutils.h:701) — Rule of 5 violation

1 participant