Bug 6706 – 'inout' is accepted in foreach, but apparently ignored
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-09-21T04:10:00Z
Last change time
2012-01-30T23:49:50Z
Keywords
accepts-invalid
Assigned to
nobody
Creator
clugdbug
Comments
Comment #0 by clugdbug — 2011-09-21T04:10:10Z
This is fail253.d from the test suite. It prints "holahola".
Changing inout into ref restores the original check in the test suite -- but I don't think this should compile.
import std.stdio;
void main() {
foreach (i; 0 .. 2)
{
foreach(inout char x; "hola") {
printf("%c", x);
x = '?';
}
}
}
Comment #1 by yebblies — 2012-01-30T23:49:50Z
This doesn't compile any more. (dmd 2.058)
It was probably fixed with the other inout bugs.