www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2676] New: alias parameters not matched in concept if clause

reply d-bugmail puremagic.com writes:
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 digitalmars.com
        ReportedBy: andrei 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))


-- 
Feb 19 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2676


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





Fixed dmd 2.026


-- 
Mar 11 2009