www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10961] New: Assigning a void[] to a Variant results in compiler errors.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10961

           Summary: Assigning a void[] to a Variant results in compiler
                    errors.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: opantm2+dbugs gmail.com


--- Comment #0 from Kapps <opantm2+dbugs gmail.com> 2013-09-03 16:35:45 PDT ---
The following sample code:

import std.variant, std.stdio;
void main() {
    void[] elements = new void[4];
    Variant v = elements;
    writeln(v);
}

Results in the following compiler errors:

variant.d(425): Error: expression (*zis)[index] is void and has no value
variant.d(675): Error: variable
std.variant.VariantN!(32LU).VariantN.get!void.get.Buf.result variables cannot
be of type void
variant.d(678): Error: a struct is not a valid initializer for a _error_
variant.d(683): Error: cannot return non-void from void function
variant.d(471): Error: template instance
std.variant.VariantN!(32LU).VariantN.get!void error instantiating
variant.d(562):        instantiated from here: handler!(void[])
variant.d(512):        instantiated from here: opAssign!(void[])
test.d(6):             instantiated from here: __ctor!(void[])
variant.d(471): Error: [arg[0LU].get()] of type void[] has no value
variant.d(440): Error: switch case fallthrough - use 'goto case;' if intended
variant.d(485): Error: switch case fallthrough - use 'goto case;' if intended
variant.d(562): Error: template instance
std.variant.VariantN!(32LU).VariantN.handler!(void[]) error instantiating
variant.d(512):        instantiated from here: opAssign!(void[])
test.d(6):               instantiated from here: __ctor!(void[])
variant.d(512): Error: template instance
std.variant.VariantN!(32LU).VariantN.opAssign!(void[]) error instantiating
test.d(6):               instantiated from here: __ctor!(void[])
test.d(6):        Error: template instance
std.variant.VariantN!(32LU).VariantN.__ctor!(void[]) error instantiating

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 03 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10961


Kapps <opantm2+dbugs gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Kapps <opantm2+dbugs gmail.com> 2013-09-03 17:33:39 PDT ---
Pull Request: https://github.com/D-Programming-Language/phobos/pull/1543

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 03 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10961


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

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


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