https://issues.dlang.org/show_bug.cgi?id=14387
Vladimir Panteleev <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #2 from Vladimir Panteleev <[email protected]> --- (In reply to Don from comment #1) > IMHO it's also pretty weird that string literals are implicitly convertable > to bool. Note that they weren't convertable in D1: assert("abc"); and > if("abc") both generated compile-time errors. I don't think that was an > intentional change, but I could be wrong. For non-static assert, D1 and D2 pre 2.023 say: test.d(4): Error: expression "test" of type invariant(char[4u]) does not have a boolean value >From 2.023 changelog: "the type of a string literal is now invariant(char)[] rather than invariant(char)[length_of_string]. It is still implicitly convertible to the latter. This is intended to reduce template instantiation bloat." This is a case of dynamic arrays implicitly converting to bool whether they're null or non-null. So, this will automatically be "fixed" when implicit array-to-bool conversion is deprecated ( https://github.com/D-Programming-Language/dmd/pull/2885 ). --
