Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#6007 closed Bugs (invalid)

syntax error in VS2010

Reported by: anonymous Owned by: jsiek
Milestone: To Be Determined Component: dynamic_bitset
Version: Boost 1.47.0 Severity: Problem
Keywords: Cc:

Description

I have error follwing subscript but i dont know how to fix it.

could you advise me?

Develop spcifications : Windows 7 64 bits, Visual studio 2010 sp1, Boost 1.47 version

1>C:\Program Files (x86)\boost\boost_1_47\boost/dynamic_bitset/dynamic_bitset.hpp(57): error C2059: syntax error : 'constant' 1> C:\Program Files (x86)\boost\boost_1_47\boost/dynamic_bitset/dynamic_bitset.hpp(477) : see reference to class template instantiation 'boost::dynamic_bitset<Block,Allocator>' being compiled 1>C:\Program Files (x86)\boost\boost_1_47\boost/dynamic_bitset/dynamic_bitset.hpp(57): error C2059: syntax error : ')' 1>C:\Program Files (x86)\boost\boost_1_47\boost/dynamic_bitset/dynamic_bitset.hpp(57): error C2238: unexpected token(s) preceding ';' 1>C:\Program Files (x86)\boost\boost_1_47\boost/pool/detail/ct_gcd_lcm.hpp(54): warning C4002: too many actual parameters for macro 'assert' 1>C:\Program Files (x86)\boost\boost_1_47\boost/pool/detail/ct_gcd_lcm.hpp(54): error C2059: syntax error : 'constant' 1> C:\Program Files (x86)\boost\boost_1_47\boost/pool/detail/ct_gcd_lcm.hpp(57) : see reference to class template instantiation 'boost::details::pool::ct_gcd<A,B>' being compiled 1>C:\Program Files (x86)\boost\boost_1_47\boost/pool/detail/ct_gcd_lcm.hpp(54): error C2059: syntax error : ')' 1>C:\Program Files (x86)\boost\boost_1_47\boost/pool/detail/ct_gcd_lcm.hpp(54): error C2238: unexpected token(s) preceding ';' 1>C:\Program Files (x86)\boost\boost_1_47\boost/pool/detail/ct_gcd_lcm.hpp(54): error C2059: syntax error : 'constant'

Change History (8)

comment:1 by webmacome@…, 11 years ago

Component: Nonedynamic_bitset
Owner: set to jsiek

comment:2 by Steven Watanabe, 11 years ago

Do you have a minimal test case for this?

If I have to guess, I'd say that it's a macro problem. Can you preprocess the source and find what boost/dynamic_bitset/dynamic_bitset.hpp line 57 expands to?

in reply to:  2 ; comment:3 by anonymous, 11 years ago

Replying to steven_watanabe:

Do you have a minimal test case for this?

If I have to guess, I'd say that it's a macro problem. Can you preprocess the source and find what boost/dynamic_bitset/dynamic_bitset.hpp line 57 expands to?

I don't have minimal test, because all the errors are in boost_1_47 I'm trying to change code enviroments from VS2008 to VS2010. It's work in Visual Stusio 2008 base.But It's not in VS2010 Should I change some options in VS 2010? Don't you have any similar problems from other users??

I include Boost BoostPython.h, dynamic_bitset.hpp, tuple.hpp, shared_ptr.hpp, shared_array.hpp

All the syntax errors are in dynamic_bitset.hpp(57), ct_gcd_lcm.hpp(54), pool.hpp(143)

Help me~plz

in reply to:  3 comment:4 by Steven Watanabe, 11 years ago

Replying to anonymous:

I don't have minimal test, because all the errors are in boost_1_47 I'm trying to change code enviroments from VS2008 to VS2010. It's work in Visual Stusio 2008 base.But It's not in VS2010 Should I change some options in VS 2010? Don't you have any similar problems from other users??

I haven't heard this one before. Basic code using dynamic_bitset compiles for me with VS2010.

I include Boost BoostPython.h, dynamic_bitset.hpp, tuple.hpp, shared_ptr.hpp, shared_array.hpp

What is BoostPython.h? I don't have such a header.

All the syntax errors are in dynamic_bitset.hpp(57), ct_gcd_lcm.hpp(54), pool.hpp(143)

Help me~plz

This is behaving as though static_assert is defined as a macro. Try adding

#ifdef static_assert
#error static_assert is defined
#endif

in the source file after all #includes. If this fires, then that's the problem. static_assert is a keyword, so whatever is #defining it is wrong.

comment:5 by anonymous, 11 years ago

I meant boost python is boost/pyton.hpp

anyway after preprocessing in vs2010,i've got follwing script. originally dynamic_bitset has this script "BOOST_STATIC_ASSERT((bool)detail::dynamic_bitset_impl::allowed_block_type<Block>::value);" but i think vs2010 can't read it.

BOOST_STATIC_ASSERT((bool)detail::dynamic_bitset_impl::allowed_block_type<Block>::value);

been changed -> ((void)0);

*after preprocessing script :

#line 42 "C:
Program Files (x86)
boost
boost_1_47
boost/dynamic_bitset/dynamic_bitset.hpp"

namespace boost {

template <typename Block, typename Allocator> class dynamic_bitset {

((void)0);

public:

typedef Block block_type; typedef Allocator allocator_type; typedef std::size_t size_type; typedef block_type block_width_type;

static const block_width_type bits_per_block = (std::numeric_limits<Block>::digits); static const size_type npos = static_cast<size_type>(-1);

public:

in reply to:  5 comment:6 by Steven Watanabe, 11 years ago

Resolution: invalid
Status: newclosed

Replying to anonymous:

BOOST_STATIC_ASSERT((bool)detail::dynamic_bitset_impl::allowed_block_type<Block>::value);

been changed -> ((void)0);

Yep. Something is definitely doing

#define static_assert assert

Whatever is causing this isn't a Boost bug.

comment:7 by fearhope@…, 10 years ago

I encountered same errors after adding VCGLib with boost lib. and I found that VCGLib had a "static_assert" macro in a header file "base.h" like as follows.

#define static_assert assert

therefore, I searched all "static_assert" lines referencing the macro in all VCGLib source files and changed it to "vcg_static_assert". Then, the compile errors all were gone.

I hope this information will help one who has similar problem.

in reply to:  7 comment:8 by anonymous, 10 years ago

Thanks! I had the same problem with VCGLib

Note: See TracTickets for help on using tickets.