On Friday, 29 November 2013 at 09:05:50 UTC, Oleg B wrote:
[code]
import std.stdio;

struct A { int val; }

A a;

class X { const ref A func() { return a; } }

void main()
{
    auto x = new X;
    x.func().val = 5;
    writeln( a );
}
[/code]

in this case 'const' mean 'const method' and variable 'a' changed.

if write
[code]
class X { const(ref A) func() { return a; } }
[/code]
ref const(A) func() { return a; }

Reply via email to