Opened 11 years ago
Closed 11 years ago
#6158 closed Bugs (fixed)
Compilation error in numeric using gcc 4.6.1 on Solaris/SPARC
Reported by: | Owned by: | Brandon Kohn | |
---|---|---|---|
Milestone: | To Be Determined | Component: | numeric |
Version: | Boost 1.48.0 | Severity: | Showstopper |
Keywords: | solaris numeric gcc | Cc: |
Description
I am getting the following errors on Solaris 10 (SPARC) using gcc 4.6.1:
./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:25:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<char, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:13:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<char, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:158:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<char, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:13:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<char, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:170:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<char, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:13:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<char, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:182:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<char, unsigned char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:37:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<char, unsigned char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:194:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<char, short int>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:49:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<char, short int>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:206:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<char, short unsigned int>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:61:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<char, short unsigned int>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:218:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<char, int>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:73:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<char, int>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:230:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<char, unsigned int>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:85:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<char, unsigned int>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:242:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<char, long long int>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:97:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<char, long long int>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:254:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<char, long long unsigned int>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:109:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<char, long long unsigned int>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:266:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<char, float>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:121:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<char, float>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:278:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<char, double>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:133:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<char, double>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:290:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<char, long double>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:145:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<char, long double>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:315:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<unsigned char, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:303:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<unsigned char, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:460:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<short int, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:448:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<short int, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:605:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<short unsigned int, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:593:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<short unsigned int, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:750:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<int, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:738:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<int, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:895:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<unsigned int, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:883:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<unsigned int, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:1040:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<long long int, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:1028:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<long long int, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:1185:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<long long unsigned int, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:1173:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<long long unsigned int, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:1330:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<float, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:1318:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<float, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:1475:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<double, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:1463:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<double, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:1620:12: error: redefinition of 'struct boost::numeric::numeric_cast_traits<long double, char>' ./boost/numeric/conversion/detail/preprocessed/numeric_cast_traits.hpp:1608:12: error: previous definition of 'struct boost::numeric::numeric_cast_traits<long double, char>'
Attachments (1)
Change History (12)
by , 11 years ago
Attachment: | cstdint_patch.diff added |
---|
comment:1 by , 11 years ago
I am seeing the same thing on windows 7, mscv100.
The error is slightly different:
error C2766: explicit specialization; 'boost::numeric::numeric_cast_traits<char,uint64_t>' has already been defined C:\svn\Backend\third_party\win32_vc100\include\boost\numeric\conversion\detail\preprocessed\numeric_cast_traits.hpp 263
Changing from using::int8_t to typedef signed char int8_t; as in the patch for solaris solves the problem here as well. Maybe the patch should be modified to change this for windows7/msvc100 too?
comment:2 by , 11 years ago
Owner: | changed from | to
---|
IMO this is the wrong fix: our code should make no assumptions about the actual type of uintXX_t etc.
IMO the preprocessed headers are just plain wrong - you can't mix concrete types (char short etc) with typedefs (intXX_t) because you're just asking for problems with duplicate specializations. It has to be all real types throughout.
BTW in addition to the two platforms mentioned above, this is also broken for Sun on Linux.
Reassigning to the person who made these changes...
comment:3 by , 11 years ago
I'll have a look at making these use the fundamental types. As a workaround you can use the following macro to disable these definitions:
#define BOOST_NUMERIC_CONVERSION_RELAX_BUILT_IN_CAST_TRAITS
comment:4 by , 11 years ago
I think the proper way to solve this is to have a single set of typedefs with the guarantee that those types/typedefs uniquely cover (disjointly) the range of fundamental types on each platform. I had naively assumed this was the case with the cstdint defs. I threw the char one in after a discussion on the mailing list which informed me that char/signed char/unsigned char were always 3 distinct types according to the standard. I suppose the most pragmatic way forward will be to define a sequence of types for each platform (with common ones rolled into sets), and then use those to generate the specializations.
comment:5 by , 11 years ago
I think the proper way to solve this is to have a single set of typedefs with the guarantee that those types/typedefs uniquely cover (disjointly) the range of fundamental types on each platform. I had naively assumed this was the case with the cstdint defs. I threw the char one in after a discussion on the mailing list which informed me that char/signed char/unsigned char were always 3 distinct types according to the standard. I suppose the most pragmatic way forward will be to define a sequence of types for each platform (with common ones rolled into sets), and then use those to generate the specializations.
I don't think that would work - besides the complete range of types are those given in the C++ standard:
char, unsigned char, signed char, short, unsigned short, int, unsigned int, long unsigned long.
Plus only if BOOST_NO_LONG_LONG is not defined: long long and unsigned long long long.
True there may be other compiler specific types hidden away - MS has __int8
__int16
etc which may or may not be distinct types depending on the compiler version. But I assume that the default template instantiation can cover any extra compiler specific types?
comment:7 by , 11 years ago
Status: | new → assigned |
---|
comment:8 by , 11 years ago
A fix is up in the trunk. Please test on those platforms at your earliest convenience.
comment:9 by , 11 years ago
I had the same problem. I can confirm that it at least compiles now (with your fix, brandon.kohn).
comment:11 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
The fix is in the 1.49 release.
cstdint.hpp patch for Solaris 10.0/gcc 4.6.1