[Issue 2541] New: cannot use aliased type for decl of foreach variable
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Dec 26 06:35:25 PST 2008
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: bugzilla at digitalmars.com
ReportedBy: adolf.mathias at googlemail.com
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.
--
More information about the Digitalmars-d-bugs
mailing list