[Issue 7256] New: std.typecons.Nullable of a const value

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 9 12:40:23 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7256

           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
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 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
(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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list