Return const object through mutable Object
Jacob Carlborg
doob at me.com
Sun Apr 15 08:57:27 PDT 2012
class Foo
{
Foo f;
Foo bar () const
{
return f;
}
}
The above code results in the compile error:
Error: cannot implicitly convert expression (this.f) of type const(Foo)
to test.Foo
But if I change "bar" to:
Object bar () const
{
return f;
}
I don't get any errors. Is the last example supposed to compile?
I'm using DMD v2.059.
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list