April 14, 2014
https://issues.dlang.org/show_bug.cgi?id=12570

Vladimir Panteleev <thecybershadow@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |thecybershadow@gmail.com
         Resolution|---                         |INVALID

--- Comment #1 from Vladimir Panteleev <thecybershadow@gmail.com> ---
No, it should not be allowed.

Consider the following extension of your example:

////////////////////////////////
import std.stdio;

interface A {}
interface B(T : A) : A
{
    // Add a method that accepts a T value.
    void foo(T c);
}

class C_a : A {}
class B_a : B!C_a
{
    // Implement this method in B_a.
    void foo(C_a c);
}

// Add another class which descends from the A interface. class X_a : A {}

void main()
{
    B_a b = new B_a;

    // Let's imagine that the compiler allowed this.
    B!A b_a = b;

    // Now, create an X_a.
    X_a x = new X_a;

    // This will be allowed!
    b_a.foo(x);

    writeln(b_a);
}
////////////////////////////////

The line "b_a.foo(x);" calls B_a.foo, which takes a C_a parameter, with an X_a parameter, which is actually an unrelated type. So, this would break the type system.

--