www.digitalmars.com         C & C++   DMDScript  

D - foreach and -inline problems

reply "Vathix" <vathix dprogramming.com> writes:
My code compiled fine until I used the -inline switch and I got this:

foo.d(581): function bar cannot access frame of function __anonymous

I realized it was trying to inline a function that contained a foreach
statement. I commented the foreach statements and it compiled ok. I noticed
this error awhile ago with constructors but I think it was fixed already.

I also noticed something odd happening with nested foreach statements, I
tried to return in the inner one and it complained about the return type:
cannot implicitly convert ListItem to int. The inner one was something like
this:
foreach(ListItem li; list) { }
and the function's return type was ListItem. There were no ints involved so
it must be from the apply function.
Oct 07 2003
parent "Walter" <walter digitalmars.com> writes:
If you could reproduce each of these with a small test case, that would be
most helpful. Thanks, -Walter

"Vathix" <vathix dprogramming.com> wrote in message
news:blvf4a$1lft$1 digitaldaemon.com...
 My code compiled fine until I used the -inline switch and I got this:

 foo.d(581): function bar cannot access frame of function __anonymous

 I realized it was trying to inline a function that contained a foreach
 statement. I commented the foreach statements and it compiled ok. I
noticed
 this error awhile ago with constructors but I think it was fixed already.

 I also noticed something odd happening with nested foreach statements, I
 tried to return in the inner one and it complained about the return type:
 cannot implicitly convert ListItem to int. The inner one was something
like
 this:
 foreach(ListItem li; list) { }
 and the function's return type was ListItem. There were no ints involved
so
 it must be from the apply function.
Oct 08 2003