https://issues.dlang.org/show_bug.cgi?id=21228
Simen Kjaeraas <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] Summary|OutputRange-based toString |Templated toString silently |is silently ignored if |ignored when it cant be |isOutputRange is not |instantiated |imported | --- Comment #2 from Simen Kjaeraas <[email protected]> --- All of the below cases are instances of this same issue: struct S1 { string toString()() { nonExistent(); } } struct S2 { void toString(R)(ref R r) if (isOutputRange!(R, char)) {} } struct S3 { import std.range : isOutputRange; void toString(R)(ref R r) if (isOutputRange!(R, char)) { nonExistent(); } } unittest { import std.conv : to; assert(S1().to!string == "S1()"); assert(S2().to!string == "S2()"); assert(S3().to!string == "S3()"); } formatValueImpl in std.format already tests for @disabled toString - it should also test for instantiability. --
