What should happen when the assert message expression throws?
H. S. Teoh
hsteoh at qfbox.info
Fri Nov 18 21:33:08 UTC 2022
On Fri, Nov 18, 2022 at 12:41:54PM -0800, Walter Bright via
Digitalmars-d wrote:
> On 11/18/2022 4:36 AM, RazvanN wrote:
> > I have stumbled upon:
> > https://issues.dlang.org/show_bug.cgi?id=17226
>
> Yes, an interesting problem.
>
> I suggest that have the format() template do the check at
> compile time,
It already does this. This works:
string s = format!"blah %f blah"(123.45);
and this will produce a compile error:
string s = format!"blah %d blah"(123.45);
So just write:
assert(myAssumption, format!"%s doesn't work!"(blah));
Problem solved.
T
--
Life begins when you can spend your spare time programming
instead of watching television. -- Cal Keegan
More information about the Digitalmars-d
mailing list