This is an archive of the discontinued LLVM Phabricator instance.

[Concepts] Add an error for unsupported P0848 (destructor overloading) code
AbandonedPublic

Authored by royjacobson on May 22 2022, 1:52 AM.

Details

Reviewers
erichkeane
cor3ntin
aaron.ballman
Group Reviewers
Restricted Project
Summary

We have received numerous (5 already) bug reports over P0848 not being implemented for destructors. We currently allow multiple destructor declarations but we will always select the first one, which might unintendedly compile with the wrong destructor.

Until we get P0848 working, this patch suggests adding diagnostic for classes that try to overload destructors with constraints so users won't be confused when their (legal) code doesn't work.

I would also like backport this to 14: anything that accidentally depends on the current behavior is already broken anyway.

(Will add release notes if accepted)

Diff Detail

Event Timeline

royjacobson created this revision.May 22 2022, 1:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 22 2022, 1:52 AM
royjacobson requested review of this revision.May 22 2022, 1:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 22 2022, 1:52 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

A working version.

royjacobson edited the summary of this revision. (Show Details)May 22 2022, 4:57 AM
royjacobson added reviewers: Restricted Project, erichkeane, cor3ntin, aaron.ballman.
royjacobson planned changes to this revision.May 22 2022, 8:42 AM

I've thought about this a bit more and I want to move the diagnostic into SemaTemplateInstantiateDecl or somewhere close. It makes more sense because it's closer to where P0848 needs to be implemented and it will spam less errors.

Move diagnostic into Sema, make it fire once for every class template definitions.

Fix conventions

royjacobson abandoned this revision.May 22 2022, 2:54 PM

I continued hacking a bit at this and I think I got a working approach to implementing P0848 (down to 6 failing tests, will probably post at least a draft tomorrow). So I'll close for now. Maybe it's still useful for backporting if someone wants to. Sorry for all the mail spam from today...