Bug 11739 – Cannot initialize const member declared void
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-12-14T06:41:00Z
Last change time
2013-12-14T11:14:53Z
Assigned to
nobody
Creator
monarchdodra
Comments
Comment #0 by monarchdodra — 2013-12-14T06:41:19Z
//----
struct S
{
const(int) i = void;
this(int j)
{
i = j;
}
}
//----
Error: cannot modify const expression i
//----
The error goes away if we remove the "void". It seems to me like a "hole" in the const member initialization feature of D?
See also (may be duplicate of):
https://d.puremagic.com/issues/show_bug.cgi?id=10643
Comment #1 by monarchdodra — 2013-12-14T06:47:59Z
Yeah, that's a duplicate. Sorry.
Comment #2 by k.hara.pg — 2013-12-14T11:14:53Z
*** This issue has been marked as a duplicate of issue 10643 ***