www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2541] New: cannot use aliased type for decl of foreach variable

reply d-bugmail puremagic.com writes:
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 digitalmars.com
        ReportedBy: adolf.mathias 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.


-- 
Dec 26 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2541


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com




------- Comment #1 from smjg iname.com  2009-01-11 17:07 -------
WFM 2.023 Windows.  Can you still reproduce on Linux?


-- 
Jan 11 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2541


Stewart Gordon <smjg iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME




--- Comment #2 from Stewart Gordon <smjg iname.com>  2009-08-25 11:11:45 PDT ---
No reply => WFM

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 25 2009