TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_CV_SPEC in type_traits/is_convertable.hpp

These three lines near the end of boost/type_traits/is_convertable.hpp: TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_CV_SPEC(float) TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_CV_SPEC(double) TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_CV_SPEC(long double) don't compile on GCC 3.4.1 when -pedantic is specified. This is actually sort of strange, because it compiles without warnings when -std=c++98 -Wall -W are specified, and -pedantic itself is not supposed to generate errors, only warnings. So, there is probably at least a GCC bug here. Does anyone have any idea what this is about? $ g++ -pedantic -I../boost -c stuff.cpp In file included from stuff.cpp:1: ../boost/boost/type_traits/is_convertible.hpp:274: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:274: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:274: error: redefinition of `struct boost::is_convertible<float, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:274: error: previous definition of `struct boost::is_convertible<float, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:274: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:274: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:274: error: redefinition of `struct boost::is_convertible<const float, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:274: error: previous definition of `struct boost::is_convertible<const float, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:274: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:274: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:274: error: redefinition of `struct boost::is_convertible<volatile float, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:274: error: previous definition of `struct boost::is_convertible<volatile float, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:274: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:274: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:274: error: redefinition of `struct boost::is_convertible<const volatile float, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:274: error: previous definition of `struct boost::is_convertible<const volatile float, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:275: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:275: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:275: error: redefinition of `struct boost::is_convertible<double, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:275: error: previous definition of `struct boost::is_convertible<double, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:275: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:275: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:275: error: redefinition of `struct boost::is_convertible<const double, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:275: error: previous definition of `struct boost::is_convertible<const double, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:275: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:275: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:275: error: redefinition of `struct boost::is_convertible<volatile double, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:275: error: previous definition of `struct boost::is_convertible<volatile double, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:275: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:275: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:275: error: redefinition of `struct boost::is_convertible<const volatile double, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:275: error: previous definition of `struct boost::is_convertible<const volatile double, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:276: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:276: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:276: error: redefinition of `struct boost::is_convertible<long double, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:276: error: previous definition of `struct boost::is_convertible<long double, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:276: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:276: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:276: error: redefinition of `struct boost::is_convertible<const long double, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:276: error: previous definition of `struct boost::is_convertible<const long double, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:276: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:276: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:276: error: redefinition of `struct boost::is_convertible<volatile long double, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:276: error: previous definition of `struct boost::is_convertible<volatile long double, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:276: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:276: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:276: error: redefinition of `struct boost::is_convertible<const volatile long double, int64_t>' ../boost/boost/type_traits/is_convertible.hpp:276: error: previous definition of `struct boost::is_convertible<const volatile long double, int64_t>' Pentium 4 on Windows XP Pro gcc 3.4.1 on mingw32 binutils 2.15 mingwrt 3.3 Thanks for your attention, Aaron W. LaFramboise

On Sun, Jul 25, 2004 at 11:29:35PM -0500, Aaron W. LaFramboise wrote:
These three lines near the end of boost/type_traits/is_convertable.hpp:
TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_CV_SPEC(float) TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_CV_SPEC(double) TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_CV_SPEC(long double)
don't compile on GCC 3.4.1 when -pedantic is specified.
This is actually sort of strange, because it compiles without warnings when -std=c++98 -Wall -W are specified, and -pedantic itself is not supposed to generate errors, only warnings.
As I understand it -pedantic disables all GNU extensions, which would otherwise be allowed with -std=c++98. This implies that without -pedantic some GNU extension accepts the code, but when that extension is disabled an error is raised because the extension contradicts the standard.
So, there is probably at least a GCC bug here. Does anyone have any idea what this is about? $ g++ -pedantic -I../boost -c stuff.cpp In file included from stuff.cpp:1: ../boost/boost/type_traits/is_convertible.hpp:274: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:274: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:274: error: redefinition of `struct boost::is_convertible<float, int64_t>'
I think it's due to the use of "long long", which isn't allowed in -pedantic mode. Or something like that. Maybe it's long double. Using -pedantic with 3.4.2 (CVS) on unix I get this diagnostic instead: boost/type_traits/is_convertible.hpp:273: error: ISO C++ does not support `long long' I think the diagnostic on mingw means that applying the "signed" modifier to "long long" is an error, similarly for "unsigned long long". Not sure why it doesn't give the same message as on unix platforms. Note that the diagnostic includes "int64_t". Could be different C99 support based on the system C headers? MinGW supports int64_t in pedantic mode, but without signed/unsigned ? Dunno. The redefinition errors are presumably because it isn't distinguishing between "signed long long" and "unsigned long long" as template params. jon -- "God is as real as I am," the old man said. My faith was restored, for I knew that Santa would never lie.

On Mon, Jul 26, 2004 at 09:55:37AM +0100, Jonathan Wakely wrote:
On Sun, Jul 25, 2004 at 11:29:35PM -0500, Aaron W. LaFramboise wrote:
These three lines near the end of boost/type_traits/is_convertable.hpp:
TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_CV_SPEC(float) TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_CV_SPEC(double) TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_CV_SPEC(long double)
don't compile on GCC 3.4.1 when -pedantic is specified.
So, there is probably at least a GCC bug here. Does anyone have any idea what this is about? $ g++ -pedantic -I../boost -c stuff.cpp In file included from stuff.cpp:1: ../boost/boost/type_traits/is_convertible.hpp:274: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:274: error: long, short, signed or unsigned used invalidly for `type name' ../boost/boost/type_traits/is_convertible.hpp:274: error: redefinition of `struct boost::is_convertible<float, int64_t>'
I think it's due to the use of "long long", which isn't allowed in -pedantic mode. Or something like that. Maybe it's long double.
FWIW, changing line 263 of is_convertible.hpp to use "int64_t" rather than "long long" causes the same (unhelpful) diagnostic on unix. So it seems that in -pedantic mode mingw uses int64_t instead of "long long", which breaks as soon as you say "[un]signed long long", because int64_t is by definition sugned (uint64_t is the unsigned equivalent).
The redefinition errors are presumably because it isn't distinguishing between "signed long long" and "unsigned long long" as template params.
Or rather, it (correctly) can't distinguish between int64_t and int64_t. jon -- No sig today
participants (2)
-
Aaron W. LaFramboise
-
Jonathan Wakely