Bug 18436 – broken opCast fails silently when used with std.conv.to

Status
NEW
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-02-14T03:13:55Z
Last change time
2024-12-01T16:32:42Z
Assigned to
No Owner
Creator
elpenguino+D
Depends on
19448
Moved to GitHub: phobos#10309 →

Comments

Comment #0 by elpenguino+D — 2018-02-14T03:13:55Z
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.
Comment #1 by elpenguino+D — 2018-11-29T21:29:26Z
https://github.com/dlang/phobos/pull/6172 attempts to fix this, but is blocked due to missing functionality. a trait to determine if a set of arguments match a template WITHOUT attempting to instantiate is required.
Comment #2 by robert.schadek — 2024-12-01T16:32:42Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10309 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB