[Issue 2676] New: alias parameters not matched in concept if clause
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Feb 19 14:17:57 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2676
Summary: alias parameters not matched in concept if clause
Product: D
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: andrei at metalanguage.com
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))
--
More information about the Digitalmars-d-bugs
mailing list