Comment #0 by bearophile_hugs — 2012-01-09T12:40:23Z
I think std.typecons.Nullable should sopport a const value too, if possible:
import std.typecons: Nullable;
const struct Foo {}
Nullable!Foo bar() {
Foo f;
return Nullable!Foo(f);
}
void main() {}
DMD 2.058 Head:
...\dmd2\src\druntime\import\object.di(454): Error: function object.TypeInfo.destroy (void* p) is not callable using argument types (const(Foo)*)
...\dmd2\src\druntime\import\object.di(454): Error: cannot implicitly convert expression (&obj) of type const(Foo)* to void*
...\dmd2\src\phobos\std\typecons.d(1188): Error: template instance object.clear!(const(Foo)) error instantiating
test.d(3): instantiated from here: Nullable!(const(Foo))
...\dmd2\src\phobos\std\typecons.d(1198): Error: can only initialize const member _value inside constructor
Comment #1 by bearophile_hugs — 2012-01-09T12:43:40Z
See also issue 7257
Comment #2 by andrej.mitrovich — 2013-02-09T21:49:35Z