Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-09-18 14:15:15


"David B. Held" <dheld_at_[hidden]> wrote in message
news:cihmvu$3ik$1_at_sea.gmane.org...
> #include <boost/static_assert.hpp>
>
> template <typename T>
> struct foo
> {
> void bar(void)
> {
> BOOST_STATIC_ASSERT(false);
> }
> };
>
> int main(void)
> {
> }
>

>
> Is gcc wrong, or am I missing something really obvious? This used
> to work. And yes, I have the latest boost CVS snapshot.

Apparently gcc is right. See
http://lists.boost.org/MailArchives/boost/msg06980.php.

The suggested workaround (maybe that's the wrong term, if it's not a bug) is:

    template<class T> struct always_false
    {
        enum { value = 0 };
    };

    template <typename T>
    struct foo
    {
         void bar(void)
         {
             BOOST_STATIC_ASSERT(always_false<T>::value);
         }
    };

Best Regards,
Jonathan


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