[Issue 20744] Using __parameters result in function definition causes wrong lookup

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 18 10:00:22 UTC 2020


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[The D Bug Tracker] UDAs on |Using __parameters result
                   |function parameters confuse |in function definition
                   |std.traits.ParameterDefault |causes wrong lookup
                   |s                           |

--- Comment #3 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
Further reduction (one module, yay!):

struct A {
    struct S {}
    void f(@S int = 3);
    pragma(msg, Issue20744!f);
}

template Issue20744(func...) {
    static if (is(typeof(func[0]) PT == __parameters)) {
        alias Issue20744 = (PT args) {};
    }
}

Moving the template to the same scope as S makes things work.

Note that accessing UDAs inside the template is not a problem, nor is using
those UDAs in most ways. The only thing I've found to cause issues is defining
a function with the result of __parameters.

--


More information about the Digitalmars-d-bugs mailing list