This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: bug with HUGE_VAL and C++ initializer lists
- To: Scott Wolford <wolford at enews dot nrl dot navy dot mil>
- Subject: Re: bug with HUGE_VAL and C++ initializer lists
- From: Mumit Khan <khan at xraylith dot wisc dot EDU>
- Date: Wed, 25 Aug 1999 16:55:32 -0500
- cc: gcc-bugs at gcc dot gnu dot org
Scott Wolford <wolford@enews.nrl.navy.mil> writes:
>
> The attached should compile (I think) but doesn't because of the funky
> way HUGE_VAL is defined in /usr/include/bits/huge_val.h. #Undef'ing
> __GNUC__ before #include'ing math.h fixes the problem but I don't think
> that's a good or long-term solution.
This is a glibc issue, and not a compiler bug per-se. Perhaps you could
send a copy to glibc2 team? It works just fine on other platforms which
define HUGE_VAL appropriately.
Perhaps the following workaround in /usr/include/huge_val.h will work
until a real fix (I have no clue how some of these GCC extensions work):
#if ! defined (__GNUC__) || defined (__cplusplus)
// use the current GCC extension to define HUGE_VAL
#else
// use the non-GCC one that works for C++ as well.
#endif
> --------------02F190B6DC055C21235A29DE
> Content-Type: application/x-unknown-content-type-cpp_auto_file;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
It's amazing to see the set of innovative Content Types grow each
day ;-)
See note on line marked '<<<<<' below.
#include <math.h>
#include <iostream.h>
class Foo
{
public:
double _value;
Foo() : _value(HUGE_VAL) {}
};
int main(int argc, char **argv)
{
Foo foo(); // <<<<< Ambiguous. Is this an object or fn decl?
cout << foo._value << endl;
}
Regards,
Mumit