www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10958] New: std.variant : Variant and Algebraic can't use a type when sizeof == 0

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

           Summary: std.variant : Variant and Algebraic can't use a type
                    when sizeof == 0
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: tcdknutson gmail.com


--- Comment #0 from Dylan <tcdknutson gmail.com> 2013-09-03 14:28:05 PDT ---
Take, for example, this code: 

`
import std.variant;

void main() {
    alias FirstType  = void[0];
    alias SecondType = void[0];

    alias Variants = Algebraic!(FirstType, SecondType);
}
`

Results in the error: 
$ dmd test_zero_sized_object.d
c:\dmd2\windows\bin\..\..\src\phobos\std\variant.d(165): Error: static assert 
(0u >= 4u) is false
c:\dmd2\windows\bin\..\..\src\phobos\std\variant.d(1149):        instantiated
from here: VariantN!(0u, void[0u], void[0u])
test_zero_sized_object.d(7):        instantiated from here:
Algebraic!(void[0u], void[0u])

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