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

Steven Schveighoffer <schvei...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schvei...@yahoo.com

--- Comment #10 from Steven Schveighoffer <schvei...@yahoo.com> ---
I think the delegate assignment should be legal. The auto-conversion from pure
ctor to immutable should be illegal (note that converting to const is not a
good test case, because you can easily assign an A to a const A without
purity), because casting the A to immutable does not affect the 'this' pointer
of the delegate member, and that could point at the given object that you are
casting or any member. I had thought that the 'this' pointer was
const-agnostic. That is:

class C
{
   void foo() {}
   void ifoo() immutable {}
}

void main()
{
   mc = new C;
   ic = new C;
   void delegate() x = &mc.foo;
   x = &mc.ifoo; // why not?
}

Why does it matter if x's delegate has an immutable 'this'? that detail is
insignificant to the caller.

--

Reply via email to