Bug#206015: libc6-dev math.h conflicts with g++-3.3.1
Package: libc6-dev
Version: 2.3.1-17
Compiler package: g++3:3.3-1
Compiler version: 3.3.1
When invoked with the options -Wall -pedantic -ffast-math -O3, g++-3.3
will refuse to compile the math.h header. It refuses (correctly, since
pedantic is set) to compile ?: expressions with lacking second operand.
How to reproduce:
Save the following program as "mathbug.cpp":
/* snip */
#include <math.h>
int main(int argc,char **)
{
return 0;
}
/* snip */
Compile with:
$ g++-3.3 mathbug.cpp -o mathbug -pedantic -O3 -ffast-math
Output is:
In file included from /usr/include/math.h:362,
from mathbug.cpp:6:
/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
I suggest to avoid ?: with lacking middle operand if -pedantic is enabled,
possibly by a define in the header, or by disabling the _FAST_MATH_ define
in this case.
Greetings,
Thomas Richter
Reply to: