Boost logo

Boost :

Subject: Re: [boost] Making lots of compile FAIL tests
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2015-06-18 05:21:41


On Wed, Jun 17, 2015 at 5:57 PM, Paul A. Bristow
<pbristow_at_[hidden]> wrote:
> I've started to devise some tests to ensure that things that really should not compile, do in fact
> compile-fail.
>
> So far I've produced a few files with a single statement that should fail inside a int main(){}.
>
> But it's looking at though it will get pretty tedious pretty soon :-(
>
> (I see for example that Boost.Multiprecision has some 50-ish compile_fail items)
>
> Is there some slicker way of doing this?

Depending on complexity of the checks you perform, you could try to
auto-generate those tests from bjam. For example, in Boost.Log I'm
generating compile tests for every public header (so that there are no
missing includes, syntax errors, etc.) using a single .cpp with a
macro that expands to the tested header name. See
libs/log/test/Jamfile.v2, rule test_all and
libs/log/test/compile/self_contained_header.cpp.


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