[Issue 17445] Disagreement between 'static assert' and 'static if'

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun May 28 07:27:02 PDT 2017


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

--- Comment #5 from Dario Schiavon <dario.schiavon at gmail.com> ---
I guess I can speculate about the reason for this behavior. What I'm doing, is
making a copiability test on a type that hasn't been completely defined yet. As
long as there's no static-if depending on the answer, the answer can be given.
Otherwise, the code inserted by the static-if might cause the answer to change,
leading to a paradox.

Of course I had something else in mind when I wrote that code. I expected the
answer to be based only on the code written so far, and I didn't intend the
static-if to produce a paradox. But I guess it would be difficult for the
compiler to prove that no paradox happens.

If all of this is correct, than it would certainly be better that the compiler
emit an error message and stop the compilation, rather than give an answer that
is surely 100% wrong.

--


More information about the Digitalmars-d-bugs mailing list