www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7256] New: std.typecons.Nullable of a const value

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc



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: -------
Jan 09 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7256




See also issue 7257

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 09 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7256


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |WORKSFORME



21:49:35 PST ---
Fixed in 2.059.

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