bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trouble with -pedantic and #include<cmath>, GCC or GLIBC bug?


From: Volker Reichelt
Subject: Trouble with -pedantic and #include<cmath>, GCC or GLIBC bug?
Date: Tue, 12 Aug 2003 17:32:24 +0200 (CEST)

Hi folks,

I don't know whether the following is really a GCC or a GLIBC issue,
so I post it to both lists. Having said that, here's the problem:

When compiling the following one-liner with GCC 3.3.1 or mainline
using the command "g++ -pedantic -O -ffast-math -c bug.cc"

===================================
#include <cmath>
===================================

I get the following error:

In file included from /usr/include/math.h:350,
                 from /home/reichelt/GCC/GCC/include/c++/3.3.1/cmath:51,
                 from bug.cc:1:
/usr/include/bits/mathinline.h: In function `long double __expm1l(long double)
   ':
/usr/include/bits/mathinline.h:385: error: ISO C++ forbids omitting the middle 
   term of a ?: expression
/usr/include/bits/mathinline.h: In function `double expm1(double)':
/usr/include/bits/mathinline.h:532: error: ISO C++ forbids omitting the middle 
   term of a ?: expression
/usr/include/bits/mathinline.h: In function `float expm1f(float)':
/usr/include/bits/mathinline.h:532: error: ISO C++ forbids omitting the middle 
   term of a ?: expression
/usr/include/bits/mathinline.h: In function `long double expm1l(long double)':
/usr/include/bits/mathinline.h:532: error: ISO C++ forbids omitting the middle 
   term of a ?: expression

This is due to line 385 in GLIBC's mathinline.h:

  return __temp + __value ?: __x

I'm using glibc 2.2.5, but the line is still present in glibc 2.3.2.

Since omitting the middle term of a ?: expression is a gcc extension, it's
a GCC bug. But since the ISO standard forbids it, it's a GLIBC bug. :-(

Should this be addressed (i.e. fixed) in GCC or in GLIBC?

(BTW the code compiled fine with GCC 3.3 or earlier.)

Regards,
Volker






reply via email to

[Prev in Thread] Current Thread [Next in Thread]