Boost logo

Boost :

From: Hervé Brönnimann (hervebronnimann_at_[hidden])
Date: 2007-03-02 01:20:32


One way to do that is to use some template meta-programming to make
the test, in fact, succeed but with a different outcome (using
SFINAE). For instance, how do you check that A is *not* convertible
to B? You can write the conversion, but if it is not it will fail
compilation, whereas you would like to get a value 0 (or mpl::false,
rather). This is done by using SFINAE and there are various ways of
doing it, check the relevant boost libraries for implementations.

Granted, the way to do it depends on your code, you have to write a
small amount of code every time, it's highly non-trivial and perhaps
not for everyone :) So simply checking for expected failures is
probably much easier!

--
Herve
On Feb 28, 2007, at 6:34 PM, Matthias Schabel wrote:
> Naturally, for compile-time units there are some cases where compile-
> time failure is
> the correct behavior - how should I structure tests so that this is
> recognized? Presumably
> I need to have a separate test source file for each expected
> compilation error, right?
>
> Matthias
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/ 
> listinfo.cgi/boost

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk