I've found a strange postblit bug (or not a bug?):

************************************

struct A
{
    this(this)
    {
    }
}

struct B
{
    A a;
}


struct C
{
    const B b;
}

void main()
{
    C c;
}

************************************

When I try to compile it, compiler raises the error: (Error: mutable method testaa2.B.__fieldPostBlit is not callable using a const object)

If I mark this(this) as const (BTW, is "this(this) const" a correct definition?) error still raises.
When I tried to reduce this code, I've found the next:

************************************

struct A
{
    this(this)
    {
    }
}

struct B
{
    const A a;
}


void main()
{
    B b;
}

************************************

Error: mutable method testaa2.A.__postblit is not callable using a const object

If I change this(this) to const, error has been lost.

************************************

struct A
{
    this(this) const
    {
    }
}

struct B
{
    const A a;
}


void main()
{
    B b;
}

************************************

Can someone comment this code? Should I think that it's a bug.

Reply via email to