[Issue 16608] 'static foreach', nested function template, 'static if', anySatisfy: Only the first iteration seems to work

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Oct 13 14:01:54 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16608

--- Comment #3 from Ali Cehreli <acehreli at yahoo.com> ---
Thanks.

I forgot to add another thing that Johan had discovered: I don't know whether
this is an implementation issue but if static foreach can be seen as an
expansion of the loop body as separate scopes then the following case seems to
be related to this bug.

There can't be two nested functions even if they are in different scopes:

void main() {
    {
        void foo(){}
    }
    {
        void foo(){}    // <-- Error
    }
}

Error: declaration foo is already defined in another scope in main

--


More information about the Digitalmars-d-bugs mailing list