The following code should not compile, as the call to test1 matches both overloads.
import std.typecons : Flag;
void test1(alias pred="a == b", T)(T a) {}
alias SomeFlag = Flag!"SomeFlag";
void test1(SomeFlag allocate_gc = SomeFlag.no, T)(T a) {}
void main()
{
test1(1);
}
Comment #1 by k.hara.pg — 2015-09-16T00:39:55Z
Reduced test case:
void test1(alias pred = "a == b", T)(T a)
{
pragma(msg, 1);
}
void test1(int flag = 0, T)(T a)
{
pragma(msg, 2);
}
void main()
{
test1(1);
}
Comment #2 by robert.schadek — 2024-12-13T18:44:43Z