[Issue 19105] Bogus recursive template expansion via getSymbolsByUDA

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 18 13:21:11 UTC 2019


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

Simen Kjaeraas <simen.kjaras at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|pull                        |rejects-valid
             Status|RESOLVED                    |REOPENED
                 CC|                            |simen.kjaras at gmail.com
         Resolution|FIXED                       |---

--- Comment #3 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
The "fix" in PR 7100 does nothing to fix the actual issue here - it only
prohibits valid use cases, and should very clearly be reverted. See issue
20054.

This issue is a DMD issue, and no amount of Phobos fiddling is gonna fix it.
Here's a reduced example:

template test(alias T) {
    alias i = T.C;
    alias test = int;
}

struct A(Args...) {}

struct S1 {
    // No error
    alias dummy = test!S1;
    alias C = A!(test!S1);
}
struct S2 {
    // Recursive template expansion
    alias C = A!(test!S2);
}

As we can see, we're not using the result of T.C, and the simple use of a dummy
alias prevents the recursive expansion. Clearly, something is wrong in the
compiler for this behavior to happen.

--


More information about the Digitalmars-d-bugs mailing list