https://issues.dlang.org/show_bug.cgi?id=20610
Issue ID: 20610
Summary: const in a .tupleof loop is ignored
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: critical
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
-----
void main ()
{
struct S
{
int what;
}
S record;
foreach (const ref field; record.tupleof)
field = 10;
}
-----
This compiles fine. It also means that if you try to call a function with this
field, it will not respect the 'const' and will allow you to modify the field.
--