Bug 867 – Error messages refer to _dtor instead of ~this

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P3
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-01-21T06:14:00Z
Last change time
2014-02-15T13:12:56Z
Keywords
diagnostic, patch
Assigned to
bugzilla
Creator
matti.niemenmaa+dbugzilla

Attachments

IDFilenameSummaryContent-TypeSize
309destuctorpatch.patchD2 patch for 867text/plain868

Comments

Comment #0 by matti.niemenmaa+dbugzilla — 2007-01-21T06:14:07Z
class Foo { abstract ~this(); } The above generates "function asdf.Foo._dtor non-virtual functions cannot be abstract". That should read "asdf.Foo.~this". class Foo { auto ~this(); } The above is similar: "function asdf.Foo._dtor functions cannot be const or auto". With const the behaviour is, of course, the same. However, a leftover from before "scope" is the following: class Foo { scope ~this(); } This emits "function asdf.Foo._dtor functions cannot be const or auto" as well. This should say something about scope.
Comment #1 by clugdbug — 2009-04-01T09:47:58Z
The 'scope' error has already been fixed for D2, but not for D1. This simple patch changes __dtor into ~this, by analogy to how it's done for constructors. Index: declaration.h =================================================================== --- declaration.h (revision 21) +++ declaration.h (working copy) @@ -661,6 +661,8 @@ Dsymbol *syntaxCopy(Dsymbol *); void semantic(Scope *sc); void toCBuffer(OutBuffer *buf, HdrGenState *hgs); + const char *kind(); + char *toChars(); int isVirtual(); int addPreInvariant(); int addPostInvariant(); Index: func.c =================================================================== --- func.c (revision 21) +++ func.c (working copy) @@ -2592,6 +2592,16 @@ return FALSE; } +const char *DtorDeclaration::kind() +{ + return "destructor"; +} + +char *DtorDeclaration::toChars() +{ + return (char *)"~this"; +} + int DtorDeclaration::isVirtual() { /* This should be FALSE so that dtor's don't get put into the vtbl[],
Comment #2 by clugdbug — 2009-04-01T09:49:44Z
Created attachment 309 D2 patch for 867
Comment #3 by bugzilla — 2009-10-13T22:52:14Z
This seems to have been fixed for a while now...