Boost logo

Boost Users :

From: João Abecasis (jpabecasis_at_[hidden])
Date: 2005-10-09 07:51:34


>Edward Grace wrote:
>>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?

John Maddock wrote:
> Sigh... It's very compiler specific I'm afraid, we can
> STATIC_ASSERTION_FAILURE into the message but that's about it at present.

Actually I've implemented an alternative STATIC_ASSERT macro that let's
one add two identifiers to better describe the error. One would be a
title and the other a more descriptive message.

The original motivation for this was to diagnose a missing include file
for Phoenix! One would get an error message containing

     missing_include::boost_spirit_phoenix_comma_hpp

when trying to use the comma operator without the above include.

The latest implementation is available here,

http://svn.berlios.de/wsvn/breeze/trunk/breeze/static_assert.hpp?op=file
(Sorry for the long url, tinyurl is not working properly, right now)

It was tested with some versions of gcc (3.3/4 and 4) and Borland 5.5.1.
I believe it used to work with MSVC 7.1 but I haven't tested lately.

Regards,

João Abecasis


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