Bug 10500 – Problem with length property when using variant

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-29T04:04:00Z
Last change time
2015-06-09T05:15:16Z
Assigned to
nobody
Creator
develop32

Comments

Comment #0 by develop32 — 2013-06-29T04:04:57Z
void main() { struct Vector { float length(); } import std.variant; Variant v = Vector(); } Currently this does not work, as it seems Variant thinks length() is a property restricted to arrays. "cannot implicitly convert expression ((*zis).length()) of type float to int C:\D\dmd2\src\phobos\std\variant.d 488" I quickly changed that line in variant.do to "static if (is(typeof(zis.length)) && is(ReturnType!(zis.length) == size_t))" and my code compiles. Currently its a hack, but should it be more developed and would it not interfere with something else?
Comment #1 by opantm2+dbugs — 2014-07-22T04:42:49Z