[Issue 19692] std.algorithm errors are useless for compile errors in templated arguments

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 22 09:37:12 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=19692

--- Comment #1 from FeepingCreature <default_357-line at yahoo.de> ---
An alternate proposal: `__traits(compiles, ...)` returns an "error object" on
failure that encapsulates the gagged error, and evaluates to false for if(),
||, etc, but is preserved through short-circuiting. Ie. error1 || error2 ->
(error1 + error2); ie. it is an entirely valid symbol that happens to
correspond to a compiler error. When a template instantiation failure is
logged, the error is output to accompany the failure.

This should preserve the cause of instantiation failures without requiring
significant changes to existing code.

--


More information about the Digitalmars-d-bugs mailing list