Bug 12071 – Algebraic won't take delegate returning structure
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-02-03T23:25:00Z
Last change time
2014-02-27T20:13:34Z
Keywords
pull
Assigned to
nobody
Creator
Jesse.K.Phillips+D
Comments
Comment #0 by Jesse.K.Phillips+D — 2014-02-03T23:25:18Z
The following code compiled with 2.064 but fails with an error with 2.065.
import std.variant;
void main() {
Structure example() { return Structure.init; }
auto m = VariantTest(&example);
}
struct Structure {}
alias Algebraic!(Structure delegate()) VariantTest;
------
C:\opt\dmd\windows\bin\..\..\src\phobos\std\variant.d(559): Error: static
assert "Cannot store a Structure in a VariantN!(8u, Structure delegate()).
Valid types are (Structure delegate())"
C:\opt\dmd\windows\bin\..\..\src\phobos\std\variant.d(531): instantiated
from here: opAssign!(Structure)
C:\opt\dmd\windows\bin\..\..\src\phobos\std\variant.d(600): instantiated
from here: handler!(Structure delegate())
C:\opt\dmd\windows\bin\..\..\src\phobos\std\variant.d(550): instantiated
from here: opAssign!(Structure delegate()) test.d(6): instantiated from
here: __ctor!(Structure delegate())
Comment #1 by Jesse.K.Phillips+D — 2014-02-03T23:31:30Z