[Issue 16957] access function from inside template with same name

2022-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16957

Iain Buclaw  changed:

   What|Removed |Added

   Priority|P1  |P2

--


[Issue 16957] access function from inside template with same name

2016-12-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16957

--- Comment #2 from John Colvin  ---
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)

--


[Issue 16957] access function from inside template with same name

2016-12-07 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16957

--- Comment #1 from John Colvin  ---
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])

--