Skip to content

[Tree] Delete virtual copy and copy assignment methods in TTree #19227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

guitargeek
Copy link
Contributor

@guitargeek guitargeek commented Jun 28, 2025

The TTree class already deletes the copy constructor and the copy assignment, but users might still be tempted to use the virtual copy constructor or copy assignment provided by TObject::Clone() and TObject::Copy(). But these implementations also make no sense to the TTree.

To avoid user confusion, this commit suggests to override these methods in TTree such that they thow an exception and tell you what to use instead.

Prevents reports like this one in the future:

The `TTree` class already deletes the copy constructor and the copy
assignment, but users might still be tempted to use the virtual copy
constructor or copy assignment provided by `TObject::Clone()` and
`TObject::Copy()`. But these implementations also make no sense to the
TTree.

To avoid user confusion, this commit suggests to override these methods
in TTree such that they thow an exception and tell you what to use
instead.

Prevents reports this one in the future:

  * https://its.cern.ch/jira/browse/ROOT-9111
@guitargeek guitargeek requested a review from lmoneta as a code owner June 28, 2025 13:11
Copy link

Test Results

    19 files      19 suites   3d 1h 51m 19s ⏱️
 3 066 tests  3 045 ✅ 0 💤  21 ❌
56 717 runs  56 356 ✅ 0 💤 361 ❌

For more details on these failures, see this check.

Results for commit 2601d6b.

@ferdymercury
Copy link
Collaborator

Tangentially related: #9252

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants