Thread overview
[Issue 16957] access function from inside template with same name
Dec 08, 2016
John Colvin
Dec 08, 2016
John Colvin
Dec 17, 2022
Iain Buclaw
December 08, 2016
https://issues.dlang.org/show_bug.cgi?id=16957

--- Comment #1 from John Colvin <john.loughran.colvin@gmail.com> ---
a related problem that seems likely to have the same root cause:

T[N] bar(T, size_t N)(T[N] a)
{
    return a;
}

alias foo = bar; // remove this line and everything's ok.

template foo(alias r)
{
    enum s = bar(r);
    pragma(msg, typeof(s), " ", s);
    enum foo = s;
}

enum x = foo!([0,1,2]);

output:
int[3] [0, 1, 2]
test.d(15): Error: cannot infer type from template instance foo!([0, 1, 2])

--
December 08, 2016
https://issues.dlang.org/show_bug.cgi?id=16957

--- Comment #2 from John Colvin <john.loughran.colvin@gmail.com> ---
template a(alias b)
{
    alias T = typeof(b);

    auto a(T ret)
    {
        return ret;
    }
}

auto a(T, size_t N)(T[N] a) {}  // breaks
// auto a(T)(T[] a) {} // OK

void main()
{
    int x;
    auto b = a!(x);
}

test.d(5): Error: undefined identifier 'T'
test.d(16): Error: cannot infer type from template instance a!(x)

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=16957

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P2

--
December 13
https://issues.dlang.org/show_bug.cgi?id=16957

--- Comment #3 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19212

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--