[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 13:12:28 PDT 2016


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

Ketmar Dark <ketmar at ketmar.no-ip.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ketmar at ketmar.no-ip.org

--- Comment #2 from Ketmar Dark <ketmar at ketmar.no-ip.org> ---
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")) ...

--


More information about the Digitalmars-d-bugs mailing list