[Issue 21069] New: Variant.get!Variant segfault
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Jul 24 01:18:03 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=21069
Issue ID: 21069
Summary: Variant.get!Variant segfault
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: minor
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: schveiguy at yahoo.com
By accident, I tried to get a Variant out of a Variant.
The result is a segfault.
Variant v = 1;
auto y = v.get!Variant; // segfault
I don't think this should segfault. I don't know what the code is doing. There
are two options to fix this:
1. get!Variant should be statically disallowed.
2. Preferred: get!Variant should `return this;`.
The second option allows generic code to not have to care about whether the
type requested is gettable. i.e. I don't have to write:
static if(is(T == Variant)) return v;
else return v.get!T;
--
More information about the Digitalmars-d-bugs
mailing list