Compile-time exceptions

Christopher Wright dhasenan at gmail.com
Mon Nov 24 05:47:57 PST 2008


bearophile wrote:
> But at the moment I haven't found ways to unit test the first two static asserts, so I just put tests in the unittest for them, and I comment them out to make the unittest run.

assert (!is (typeof (nest(1, 1, 1)))); // int is not callable

If you're using d2:
assert (!__traits (compiles, nest(1, 1, 1)));



More information about the Digitalmars-d mailing list