[Issue 4338] New: Structs with non-const destructors cannot be used as const parameters
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jun 17 00:03:51 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4338
Summary: Structs with non-const destructors cannot be used as
const parameters
Product: D
Version: D2
Platform: Other
OS/Version: Windows
Status: NEW
Keywords: diagnostic
Severity: major
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: clugdbug at yahoo.com.au
--- Comment #0 from Don <clugdbug at yahoo.com.au> 2010-06-17 00:03:49 PDT ---
TEST CASE:
struct A {
~this() {}
}
void foo(const A a) {}
---------
bug.d(4): Error: destructor bug.A.~this () is not callable using argument types
()
Workaround is to change ~this() into const ~this().
I find this whole situation pretty weird. How can a destructor be const? (Is a
const struct effectively 'tail const', so that a const destructor only destroys
the non-const bit?)
And anyway, should a destructor be called on non-mutable function parameters?
In any case, the error message is rather poor.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list