[Issue 12885] New: const union wrongly converts implicitly to mutable
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Jun 9 16:36:01 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12885
Issue ID: 12885
Summary: const union wrongly converts implicitly to mutable
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: ASSIGNED
Keywords: accepts-invalid
Severity: enhancement
Priority: P1
Component: DMD
Assignee: nilsbossung at googlemail.com
Reporter: nilsbossung at googlemail.com
Depends on: 12883
---
union U
{
int i;
int* p;
}
void main()
{
const U c;
U m = c;
}
---
This has been enabled by the fix to issue 11257. I think this behaviour is not
acceptable. The change has been made to "allow const(Rebindable) to Rebindable
conversion". I think this should be implemented in Rebindable itself, as that's
the place where we can give the guarantee not to alter the wrapped
const/immutable data. alias this can be used for this once issue 12883 is
fixed.
--
More information about the Digitalmars-d-bugs
mailing list