Bug 10958 – std.variant : Variant and Algebraic can't use a type when sizeof == 0
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-09-03T14:28:00Z
Last change time
2014-02-15T15:11:44Z
Keywords
pull
Assigned to
opantm2+dbugs
Creator
tcdknutson
Comments
Comment #0 by tcdknutson — 2013-09-03T14:28:05Z
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])
Comment #1 by opantm2+dbugs — 2014-02-13T22:33:10Z