Opened 7 years ago

Closed 7 years ago

#11750 closed Bugs (wontfix)

error when compiling boost 1.59 : error: two or more data types in declaration of 'parameter

Reported by: ramanats@… Owned by: John Maddock
Milestone: To Be Determined Component: type_traits
Version: Boost 1.59.0 Severity: Problem
Keywords: atomic type_traits Cc:

Description

My platform is 32 bit RH Linux 5.1 with g++ 4.1.2.

I have a dynamic (.so) library that includes boost/atomic.hpp. The library compiles without issues. When I build the main application that uses this library, I get the following errors related to boost/type_traits/detail hpp files.

/path_to_boost/boost/type_traits/detail/ice_or.hpp:16: error: two or more data types in declaration of 'parameter' /path_to_boost/boost/type_traits/detail/ice_or.hpp:16: error: long, short, signed or unsigned invalid for 'parameter' /path_to_boost/boost/type_traits/detail/ice_or.hpp:16: error: long, short, signed or unsigned invalid for 'parameter' /path_to_boost/boost/type_traits/detail/ice_or.hpp:16: error: two or more data types in declaration of 'parameter' /path_to_boost/boost/type_traits/detail/ice_or.hpp:16: error: long, short, signed or unsigned invalid for 'parameter' /path_to_boost/boost/type_traits/detail/ice_or.hpp:19: error: two or more data types in declaration of 'parameter' /path_to_boost/boost/type_traits/detail/ice_or.hpp:19: error: long, short, signed or unsigned invalid for 'parameter' /path_to_boost/boost/type_traits/detail/ice_or.hpp:19: error: long, short, signed or unsigned invalid for 'parameter' /path_to_boost/boost/type_traits/detail/ice_or.hpp:19: error: two or more data types in declaration of 'parameter' /path_to_boost/boost/type_traits/detail/ice_or.hpp:19: error: long, short, signed or unsigned invalid for 'parameter' /path_to_boost/boost/type_traits/detail/ice_and.hpp:17: error: two or more data types in declaration of 'parameter' /path_to_boost/boost/type_traits/detail/ice_and.hpp:17: error: long, short, signed or unsigned invalid for 'parameter' /path_to_boost/boost/type_traits/detail/ice_and.hpp:17: error: long, short, signed or unsigned invalid for 'parameter' /path_to_boost/boost/type_traits/detail/ice_and.hpp:17: error: two or more data types in declaration of 'parameter' /path_to_boost/boost/type_traits/detail/ice_and.hpp:17: error: long, short, signed or unsigned invalid for 'parameter' /path_to_boost/boost/type_traits/detail/ice_and.hpp:20: error: two or more data types in declaration of 'parameter' /path_to_boost/boost/type_traits/detail/ice_and.hpp:20: error: long, short, signed or unsigned invalid for 'parameter' /path_to_boost/boost/type_traits/detail/ice_and.hpp:20: error: long, short, signed or unsigned invalid for 'parameter' /path_to_boost/boost/type_traits/detail/ice_and.hpp:20: error: two or more data types in declaration of 'parameter' /path_to_boost/boost/type_traits/detail/ice_and.hpp:20: error: long, short, signed or unsigned invalid for 'parameter' /path_to_boost/boost/type_traits/detail/ice_eq.hpp:16: error: two or more data types in declaration of 'parameter' /path_to_boost/boost/type_traits/detail/ice_eq.hpp:19: error: expected primary-expression before 'signed' /path_to_boost/boost/type_traits/detail/ice_eq.hpp:19: error: expected `)' before 'signed' /path_to_boost/boost/type_traits/detail/ice_eq.hpp:22: error: two or more data types in declaration of 'parameter' /path_to_boost/boost/type_traits/detail/ice_eq.hpp:25: error: expected primary-expression before 'signed' /path_to_boost/boost/type_traits/detail/ice_eq.hpp:25: error: expected `)' before 'signed' /path_to_boost/boost/type_traits/detail/ice_eq.hpp:29: error: two or more data types in declaration of 'parameter' /path_to_boost/boost/type_traits/detail/ice_eq.hpp:29: error: type/value mismatch at argument 1 in template parameter list for 'template<int <anonymous>, short int <anonymous> > struct boost::type_traits::ice_eq' /path_to_boost/boost/type_traits/detail/ice_eq.hpp:29: error: expected a constant of type 'int', got 'signed char' /path_to_boost/boost/type_traits/detail/ice_eq.hpp:29: error: type/value mismatch at argument 2 in template parameter list for 'template<int <anonymous>, short int <anonymous> > struct boost::type_traits::ice_eq' /path_to_boost/boost/type_traits/detail/ice_eq.hpp:29: error: expected a constant of type 'short int', got 'short int' /path_to_boost/boost/type_traits/detail/ice_eq.hpp:29: error: template declaration of 'const bool boost::type_traits::value' /path_to_boost/boost/type_traits/detail/ice_eq.hpp:30: error: two or more data types in declaration of 'parameter' /path_to_boost/boost/type_traits/detail/ice_eq.hpp:30: error: type/value mismatch at argument 1 in template parameter list for 'template<int <anonymous>, short int <anonymous> > struct boost::type_traits::ice_ne' /path_to_boost/boost/type_traits/detail/ice_eq.hpp:30: error: expected a constant of type 'int', got 'signed char' /path_to_boost/boost/type_traits/detail/ice_eq.hpp:30: error: type/value mismatch at argument 2 in template parameter list for 'template<int <anonymous>, short int <anonymous> > struct boost::type_traits::ice_ne' /path_to_boost/boost/type_traits/detail/ice_eq.hpp:30: error: expected a constant of type 'short int', got 'short int' /path_to_boost/boost/type_traits/detail/ice_eq.hpp:30: error: template declaration of 'const bool boost::type_traits::value'

Change History (4)

comment:1 by anonymous, 7 years ago

Which version of Boost?

I ask because that header is deprecated and it's use removed from current Git, so probably this will disappear anyway...

comment:2 by subra raman <ramanats@…>, 7 years ago

This is with boost version 1.59.0.

I tried the suggestion to remove the /path/boost/type_traits/detail/ice*.hpp files, then I get some errors as follows:

./boost/type_traits/ice.hpp:15:47: error: boost/type_traits/detail/ice_or.hpp: No such file or directory .../boost/type_traits/is_reference.hpp:30: error: 'ice_or' is not a member of 'boost::type_traits'

So seems like these ice*.hpp files are needed.

comment:3 by subra raman <ramanats@…>, 7 years ago

I read a related thread on stackoverflow (http://stackoverflow.com/questions/15406119/two-or-more-data-types-in-declaration-of-parameters-using-mingw-cross-compiler) that this error could be because of multiple type definitions in a parameter list.

Code snippet from ice_or.cpp, errors reported on lines 16 and 19.

13 namespace boost { 14 namespace type_traits { 15 16 template <bool b1, bool b2, bool b3 = false, bool b4 = false, bool b5 = false, bool b6 = false, bool b7 = false> 17 struct ice_or; 18 19 template <bool b1, bool b2, bool b3, bool b4, bool b5, bool b6, bool b7> 20 struct ice_or 21 { 22 BOOST_STATIC_CONSTANT(bool, value = true); 23 };

I was able to get past this issue, by renaming the parameter names from ice_or.hpp, ice_and.hpp and ice_eq.hpp from b1.. b7 to a1.. a7. Not sure why b1, .. b7 were causing issue ? Maybe something in my code base has something to do with it ?

Hopefully this will help some one :-)

comment:4 by John Maddock, 7 years ago

Resolution: wontfix
Status: newclosed

Sounds like maybe something was declaring those names as macros?

In any case, like I said, the *next* release won't be using these files, so the problem should go away then.

Note: See TracTickets for help on using tickets.