Bug 8954 – Missing line number in error message for uncollable destructor/postblit

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-11-03T04:50:18Z
Last change time
2022-01-28T10:13:10Z
Keywords
diagnostic
Assigned to
No Owner
Creator
Denis Shelomovskii

Comments

Comment #0 by verylonglogin.reg — 2012-11-03T04:50:18Z
--- struct S { this(this) { } ~this() { } } struct S2 { const S s; } --- Output: --- Error: destructor main.S.~this () is not callable using argument types () const Error: function main.S.__postblit () is not callable using argument types () const --- Severity is "Critical" as Don write in Issue 5314, comment 10: > They're equivalent to compiler segfaults. Worse than any rejects-valid bug. > They're nearly always very easy to fix, too. There's no excuse for them.
Comment #1 by maxim — 2013-05-03T05:15:12Z
*** Issue 10020 has been marked as a duplicate of this issue. ***
Comment #2 by maxim — 2013-05-03T05:21:57Z
*** Issue 9031 has been marked as a duplicate of this issue. ***
Comment #3 by andrej.mitrovich — 2014-02-12T13:41:01Z
Internal notes for other compiler devs: Offending code for postblits in StructDeclaration::buildPostBlit: ----- Loc loc = Loc(); // internal code should have no loc to prevent coverage ----- Commenting that out fixes it for postblits. For dtors it's in AggregateDeclaration::buildDtor(Scope *sc): ----- Loc loc = Loc(); // internal code should have no loc to prevent coverage ----- I think it can be fixed by adding an 'isInternal' field to the dtor/postblit classes and passing a valid Loc, then cov generation could check isInternal while other diagnostics code doesn't have to be touched. Will try this out.
Comment #4 by andrej.mitrovich — 2014-02-12T13:46:16Z
(In reply to comment #3) > I think it can be fixed by adding an 'isInternal' field to the dtor/postblit > classes and passing a valid Loc, then cov generation could check isInternal > while other diagnostics code doesn't have to be touched. Will try this out. Nevermind, it's actually CallExp which needs the Loc info. Still it's fixable.
Comment #5 by razvan.nitu1305 — 2022-01-28T10:13:10Z
This code now compiles successfully.