[Issue 13628] New: Error: immutable method S.~this is not callable using a mutable object and vice versa
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Oct 17 06:00:16 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13628
Issue ID: 13628
Summary: Error: immutable method S.~this is not callable using
a mutable object and vice versa
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: major
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: Marco.Leise at gmx.de
I get these errors on structs that define a `~this() immutable`:
Error: immutable method Lib.Sys.File.File.~this is not callable using a
mutable object
Error: mutable method Lib.Sys.File.File.~this is not callable using a
immutable object
Error: mutable method Lib.Sys.FileMapping.FileMapping.~this is not callable
using a immutable object
Error: mutable method Lib.Sys.File.File.~this is not callable using a
immutable object
Error: immutable method Lib.Sys.FileMapping.FileMapping.~this is not
callable using a mutable object
For starters it would be nice in which functions these destructions happen.
But then ... WAT?
A) Why would the compiler call the exact opposite dtor of what is needed and
the complain? :)
B) If I did actually try to define both `~this()` and `~this() immutable` the
compiler would complain that I cannot define both.
C) Why can a dtor be immutable if you cannot even define both a mutable and
immutable version to special case some code? It seems to add a lot of
complexity.
It seems to me that immutable still has a way to go or that we need to disallow
certain usages of immutable.
--
More information about the Digitalmars-d-bugs
mailing list