|
Boost : |
From: Jonathan Wakely (cow_at_[hidden])
Date: 2004-07-26 03:55:37
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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk