From: Edward Diener (eddielee_at_[hidden])
Date: 2003-12-05 19:03:22
David Abrahams wrote:
> "Edward Diener" <eddielee_at_[hidden]> writes:
>> AlisdairM wrote:
>>> The test is a 'compile-fail', so the test fails only if the compiler
>>> actually passes the code!
>> Is that what a 'compile-fail' test really means ? I don't think that
>> can be right.
> It is right, in fact.
>> I would always assume that Fail means something is wrong, either an
>> error at compile time or a crash or incorrect result at run-time.
> Something is wrong when a static assertion that's supposed to fire
> doesn't do so. Something is wrong if I can compile
> boost::shared_ptr<int>(new char('a'));
> There are lots of reasons to write a compile-fail test.
OK, I think I get it. Essentially a 'compile-fail' test is a test that
succeeds when the compiler fails with some error, and fails if it does not.
The test is made to make sure that the compiler correctly catches an error
in the code.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk