Boost logo

Boost :

From: Mark Purtill (purtill_at_[hidden])
Date: 2004-09-25 23:52:59


        BOOST_STATIC_ASSERT doesn't produce a useful error message
with gcc 3.3. E.g.:

#include <boost/static_assert.hpp>

BOOST_STATIC_ASSERT(0);

produces

% g++ -c -o bsa.o bsa.cpp
bsa.cpp:3: error: invalid application of `sizeof' to an incomplete type

According to <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15337>, this
is fixed, but some of use will still be using gcc 3.3 for a while. It
turns out the version of BOOST_STATIC_ASSERT used when
BOOST_INTEL_CXX_VERSION is defined works for the offending versions of
gcc, too:

#include <boost/static_assert.hpp>
# define BOOST_STATIC_ASSERT_1( B ) \
    typedef char BOOST_JOIN(boost_static_assert_typedef_, __LINE__) \
        [ ::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >::value ]

BOOST_STATIC_ASSERT_1(0);

produces

% g++ -c -o bsa.o bsa.cpp
bsa.cpp:6: error: incomplete type `boost::STATIC_ASSERTION_FAILURE<false>' does
   not have member `value'

Could that version be used for gcc 3.3 and 3.4.0 in the upcoming boost
1.32?

FYI:

% gcc -v
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/specs
Configured with: /var/tmp/portage/gcc-3.3.4-r1/work/gcc-3.3.4/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.3 --includedir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3/info --enable-shared --host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --with-system-zlib --enable-languages=c,c++ --enable-threads=posix --enable-long-long --disable-checking --disable-libunwind-exceptions--enable-cstdio=stdio --enable-version-specific-runtime-libs --with-gxx-include-dir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/include/g++-v3 --with-local-prefix=/usr/local --enable-shared --enable-nls --without-included-gettext --disable-multilib --enable-__cxa_atexit --enable-clocale=generic
Thread model: posix
gcc version 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)

-- 
^.-.^ Mark Purtill 
((")) 

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