[Issue 18436] New: broken opCast fails silently when used with std.conv.to
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Feb 14 03:13:55 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18436
Issue ID: 18436
Summary: broken opCast fails silently when used with
std.conv.to
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: elpenguino+D at gmail.com
Invalid code like the following will (correctly) fail to compile, but the error
preventing it from compiling will not be shown to the user.
struct X {
T opCast(T)() {
nonexistent();
return T.init;
}
}
assert(X().to!bool == bool.init);
The compiler ought to complain about nonexistent being undefined instead of
simply failing to match toImpl's template declaration.
--
More information about the Digitalmars-d-bugs
mailing list