Subject: Re: [boost] [Config] Macros for the absence of a full C++11 <memory> implementation
From: Peter Dimov (lists_at_[hidden])
Date: 2014-02-11 10:28:50


John Maddock wrote:

> Would somebody like to produce a patch?

I'm trying to but have hit a snag.

I have this as boost_no_cxx11_addressof.ipp:

#include <memory>

namespace boost_no_cxx11_addressof {

void x3()
{
}

int test()
{
   int x1, x2[3];
   return std::addressof(x1) != &x1 || std::addressof(x2) != &x2 ||
std::addressof(x3) != &x3;
}

}

That is, I am not just testing whether std::addressof compiles, I'm also
testing if it actually works.

This is a problem because the expectation for this file is to fail
compilation when the macro ought to be set. However, it sometimes fails
compilation (when std::addressof is not present at all), and sometimes fails
at runtime (when std::addressof is present but doesn't pass the test, as in
VC++12).

And we don't have a rule for that. compile-fail always wants it to fail
compilation; run-fail always wants it to compile/link and only then fail. I
don't know how one can express "this test should fail at compile time or at
run time" in Boost.Build.