Comment #0 by john.loughran.colvin — 2016-12-08T00:21:39Z
auto a() { return 1; }
enum a() = .a();
enum b = a!();
test.d(2): Error: none of the overloads of 'a' are callable using argument types (), candidates are:
test.d(1): test.a()
test.d(3): Error: template instance test.a!() error instantiating
Comment #1 by john.loughran.colvin — 2016-12-08T00:40:02Z
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])
Comment #2 by john.loughran.colvin — 2016-12-08T12:54:00Z
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)
Comment #3 by robert.schadek — 2024-12-13T18:50:55Z