Boost logo

Boost Users :

From: Edward Grace (ej.grace_at_[hidden])
Date: 2005-10-03 04:46:20


Dear All,

I am encountering a problem with BOOST_STATIC_ASSERT, it is producing
compile-time errors that are a little cryptic.

When using BOOST_STATIC_ASSERT such as

class rtm : public matrix<ElementType> {
  BOOST_STATIC_ASSERT(::boost::is_float<ElementType>::value ||
                      ejg::boost::is_complex<ElementType>::value);
public:
...
...
..

Instantiation of the rtm class with a non float or non complex type, such as:

   ejg::oned::rtm<char> M;

 causes the following compiler error.

 error: invalid application of sizeof to incomplete type
boost::STATIC_ASSERTION_FAILURE<false>

Boost 1.32.0
g++ 4.0.1

Obviously generating a compiler error is the correct behaviour, I want to make
sure that only complex or float type objects are instantiated. The problem
is that the compiler error is rather cryptic.

>From the documentation of boost
http://www.boost.org/doc/html/boost_staticassert.html, I should be seeing

Illegal use of STATIC_ASSERTION_FAILURE<false>

Is there any way this can be improved by generating the error or is it too
much of a compiler issue?

-ed


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net