On 2010-05-05 07:46:46 -0400, bearophile <bearophileh...@lycos.com> said:
Michel Fortin:
Can't you do:
static assert(throws!OtherException(sqrt(-5)));
?
Some of those examples of mine were wrong because the main purpose of a
'static throws' is to catch static asserts, not to catch exceptions at
compile time, sorry:
Am I right that what you want is this?
static assert(!__traits(compiles, foo(10)));
I agree that the __traits syntax leaves a lot of room for improvement.
(And currently try-catch statements are not supported in CTFE, see
http://d.puremagic.com/issues/show_bug.cgi?id=4067 ).
Indeed.
--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/