Bug 2676 – alias parameters not matched in concept if clause
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2009-02-19T16:17:00Z
Last change time
2015-06-09T05:15:21Z
Assigned to
bugzilla
Creator
andrei
Comments
Comment #0 by andrei — 2009-02-19T16:17:58Z
Consider this code:
struct A1(T)
{
}
void foo1(X)(X x) if (is(X Y == A1!(U), U))
{
static if (is(X Y == A!(U), U))
writeln(U.stringof);
}
//
struct A2(alias T)
{
}
void foo2(X)(X x) if (is(X Y == A2!(U), alias U))
{
// static if (is(X Y == A!(U), U))
// writeln(U.stringof);
}
void bar() {}
void main()
{
A1!(int) a1;
foo1(a1);
A2!(bar) a2;
foo2(a2);
}
The code with A1 and foo1 illustrates how concept-if works for type template parameters. Similar code that uses aliases instead of types should be matched the same, but it never is. The code compiles A1/foo1 but fails on A2/foo2) with:
template test.foo2(X) if (is(X Y == A2!(U),alias U)) cannot deduce template function from argument types !()(A2!(bar))