http://d.puremagic.com/issues/show_bug.cgi?id=10063
Summary: inout+pure results in ability to produce immutable
reference to mutable data
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: accepts-invalid
Severity: critical
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Denis Shelomovskij <[email protected]> 2013-05-11
05:12:50 MSD ---
This code compiles but shouldn't:
---
inout(void)* f(inout void* p) pure
{ return p; }
immutable(void)* g(inout int* p) pure
{ return f(p); }
---
Explicit or implicit cast is required for this issue to appear. Change `g` to
accept `void*` instead of `int*` to see expected compilation error.
Another test-case:
---
struct S
{
uint* p;
inout(void)* f() pure inout
{ return p; }
immutable(void)* g() pure inout
{ return f(); }
}
---
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------