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

2016-10-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16608

Vladimir Panteleev  changed:

   What|Removed |Added

 CC||thecybersha...@gmail.com

--- Comment #7 from Vladimir Panteleev  ---


*** This issue has been marked as a duplicate of issue 14831 ***

--


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

2016-10-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16608

Mathias Lang  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||mathias.l...@sociomantic.co
   ||m
 Resolution|--- |DUPLICATE

--- Comment #6 from Mathias Lang  ---
Yeah, sadly this is a known (and old bug), one of the worst IMO.
The meta bug that Kenji opened to solve this is
https://issues.dlang.org/show_bug.cgi?id=14831

*** This issue has been marked as a duplicate of issue 14381 ***

--


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

2016-10-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16608

--- Comment #4 from Ketmar Dark  ---
yeah, another known bug: #11720

--


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

2016-10-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16608

--- Comment #5 from Ketmar Dark  ---
yay, i can never remember what kind of numbers will be turned to links here:
https://issues.dlang.org/show_bug.cgi?id=11720

--


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

2016-10-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16608

--- Comment #3 from Ali Cehreli  ---
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

--


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

2016-10-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16608

Ketmar Dark  changed:

   What|Removed |Added

 CC||ket...@ketmar.no-ip.org

--- Comment #2 from Ketmar Dark  ---
yeah, semi-known thing for static foreach: sometimes it is failing to
instantiate 2nd and more template instances. actually, not really failing, but
cannot see that templates for different iterations are really different, and
merging 'em into one.

afair, here frontend sees a template whose signature (mangled name, actually)
doesn't change between iterations, and deciding that one will be enough. ;-)

this is hard to fix without introducing some (noticable) slowdown (or, maybe,
proper `static foreach` operator).

for now, force instantiation with alias seems to be the only solution (this is
for those people who interested in workaround until this issue is somehow
fixed):

alias cc = condition!s;
... anySatisfy!(cc, AliasSeq!("b")) ...

--


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

2016-10-11 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16608

Ali Cehreli  changed:

   What|Removed |Added

Summary|'static foreach', local |'static foreach', nested
   |function template, 'static  |function template, 'static
   |if', anySatisfy: Only the   |if', anySatisfy: Only the
   |first iteration seems to|first iteration seems to
   |work|work

--