http://d.puremagic.com/issues/show_bug.cgi?id=2541
Summary: cannot use aliased type for decl of foreach variable
Product: D
Version: 2.022
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
The following program
alias uint Uint;
void main() {
foreach(Uint u;1..10) {}
for(Uint u=1;u<10;u++) {}
}
fails with the messages
bug.d(4): Error: forward reference to type Uint
bug.d(4): Error: cannot implicitly convert expression (1) of type int to Uint
bug.d(4): Error: forward reference to type Uint
bug.d(4): Error: cannot implicitly convert expression (10) of type int to Uint
bug.d(4): Error: Uint is not a scalar type
All similar attempts produced the same messages. Funny that the simple for loop
and foreach with builtin types work.
--