[Issue 3125] statement foreach semantic opApply should be tried if range funcs not satisfied

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 2 20:37:28 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3125


Jarrett Billingsley <jarrett.billingsley at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jarrett.billingsley at gmail.c
                   |                            |om




--- Comment #5 from Jarrett Billingsley <jarrett.billingsley at gmail.com>  2009-07-02 20:37:27 PDT ---
(In reply to comment #4)
> Here it is:
> 
> class c
> {
>         int head()
>         {
>                 return 0;
>         }
>         int opApply(int delegate(ref int x) dg)
>         {
>                 int i;
>                 i=3;
>                 dg(i);
>                 return 1;
>         }
> }
> 
> void main()
> {
>         c c;
>         c= new c;
>         foreach(m;c)
>         {
>                 assert(m==3);
>         }
> }

You fail it.  The error from this code is not related to the reported bug at
all.  The lines

>         c c;
>         c= new c;

are illegal.  If you change it to 

>         c c = new c;

it works fine in 2.029.

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


More information about the Digitalmars-d-bugs mailing list