Bug 3606 – Problems with struct destructors and const structs
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2009-12-11T05:44:00Z
Last change time
2015-06-09T01:27:05Z
Assigned to
nobody
Creator
webby
Comments
Comment #0 by webby — 2009-12-11T05:44:37Z
Using DMD 2.037, trying to compile the code:
////////////////////////////////
struct Foo
{
~this()
{
}
}
void Bar()
{
const Foo f;
}
////////////////////////////////
Fails with the error:
Error: destructor Foo.~this () is not callable using argument types ()
Which seems a bit strange.
Comment #1 by dfj1esp02 — 2009-12-11T07:05:10Z
Errors in 2.031:
Error: destructor tmp.Foo.~this () does not match parameter types ()
Error: f.~this can only be called on a mutable object, not const(Foo)
Comment #2 by dfj1esp02 — 2009-12-11T07:08:40Z
Well... compiler's complaints are understandable, you are trying to do meaningless thing.