[Issue 19293] New: Qualified inherited class does not have any effect

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 8 10:36:56 UTC 2018


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 at puremagic.com
          Reporter: razvan.nitu1305 at 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").

--


More information about the Digitalmars-d-bugs mailing list