www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19293] New: Qualified inherited class does not have any effect

https://issues.dlang.org/show_bug.cgi?id=19293

          Issue ID: 19293
           Summary: Qualified inherited class does not have any effect
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: razvan.nitu1305 gmail.com

import std.stdio : writeln;

class A
{
    int a;
}

class B : immutable(A)
{
    this(int a)
    {   
        this.a = a;
    }   

    void fun()
    {   
        a = 8;
    }   
}

void main()
{
    B b = new B(7);
    writeln(b.a);      // 7
    b.fun();

    writeln(b.a);      // 8
}

According to the grammar, the inheritance list can contain only unqualified
types, so this code should be rejected ("cannot qualifiy inherited class
types").

--
Oct 08 2018