bits/mathcalls.h causes declarations in global namespace in C++

Bug #1578857 reported by Carlo Wood
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
glibc (Ubuntu)
New
Undecided
Unassigned

Bug Description

Compiling a C++ program that only included standard headers should never
define or declare anything outside of namespace std.

However, try to compile this:

#include <cmath>
int y0;

>g++ junk.cc
junk.cc:3:5: error: ‘int y0’ redeclared as different kind of symbol
 int y0;
     ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/x86_64-linux-gnu/c++/4.8/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/4.8/bits/c++config.h:426,
                 from /usr/include/c++/4.8/cmath:41,
                 from junk.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:240:1: error: previous declaration of ‘double y0(double)’
 __MATHCALL (y0,, (_Mdouble_));
 ^

The file in question defines a lot (which is supposedly on purpose for the C language with GNU extension),
which is shouldn't do that when compiling a C++ program.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.