[Bug 1578857] [NEW] bits/mathcalls.h causes declarations in global namespace in C++

Carlo Wood carlo at alinoe.com
Thu May 5 23:12:26 UTC 2016


Public bug reported:

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.

** Affects: glibc (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to glibc in Ubuntu.
https://bugs.launchpad.net/bugs/1578857

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

Status in glibc package in Ubuntu:
  New

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 manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1578857/+subscriptions



More information about the foundations-bugs mailing list