Boost logo

Boost Users :

Subject: [Boost-users] BOOST_STATIC_ASSERT has different behavior on different platforms
From: Alexander Vinokur (Alexander.Vinokur_at_[hidden])
Date: 2010-07-27 00:32:24


BOOST_STATIC_ASSERT has different behavior on different platforms

Boost 1.34

-------- File foo01. cpp --------
#include <boost/static_assert.hpp>

struct Foo
            int m_value;

            BOOST_STATIC_ASSERT(sizeof(this->m_value) == 4);

int main()
            Foo f;

            return 0;

No compilation errors on UNIX compilers
HP: aCC: HP C/aC++ B3910B A.06.25.01 [May 16 2010]
Sun: C++ 5.9 SunOS_sparc Patch 124863-01 2007/07/25
AIX: IBM XL C/C++ Enterprise Edition V8.0 for AIX; Version: 08.00.0000.0014
Linux: Intel(R) C++ Intel(R) 64 Compiler, Version 11.0

There are compilation errors on Windows compiler
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86
foo01.cpp(11) : error C2355: 'this' : can only be referenced inside non-static member functions
foo01.cpp(11) : error C2227: left of '->m_value' must point to class/struct/union/generic type
foo01.cpp(11) : error C2027: use of undefined type 'boost::STATIC_ASSERTION_FAILURE'
        C:\ADJUST\3rdParties\boost_1_34_0\boost/static_assert.hpp(34) : see declaration of 'boost::STATIC_ASSERTION_FAILURE'


Alex Vinokur

This message and the information contained herein is proprietary and confidential and subject to the Amdocs policy statement,
you may review at

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at