Summary: std.typecons.Nullable of a const value
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: enhancement
          Priority: P2
         Component: Phobos

--- Comment #0 from 2012-01-09 12:40:23 PST ---
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
...\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

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to