https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11196
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2005-12-31 03:19:52 |2016-5-17
--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jan van Dijk from comment #10)
> Has this been (partly) fixed in the meantime? The OP's test program compiles
> just fine with:
>
> g++ (SUSE Linux) 4.8.3 20140627 [gcc-4_8-branch revision 212064]
> g++ (SUSE Linux) 5.3.1 20160412 [gcc-5-branch revision 234894]
> g++ (GCC) 7.0.0 20160516 (experimental)
> x86_64-w64-mingw32.shared-g++ (GCC) 4.9.3
It's not fixed, but we reduced the internal header dependencies so that
<iostream> no longer includes <math.h>
Try:
#include <random>
using namespace std;
const double M_PI = 3.1415;
int main()
{
double pi = M_PI;
}
In file included from /home/jwakely/gcc/7/include/c++/7.0.0/cmath:45:0,
from /home/jwakely/gcc/7/include/c++/7.0.0/random:38,
from g.cc:1:
g.cc:4:14: error: expected unqualified-id before numeric constant
const double M_PI = 3.1415;
^
g.cc: In function ‘int main()’:
g.cc:8:12: warning: unused variable ‘pi’ [-Wunused-variable]
double pi = M_PI;
^~
> I also see that GNU_SOURCE is no longer implicitly defined. At least, I do
> not
> see that in the output of "g++ -dM -E - < /dev/null" anymore.
>
> Are there any remaining issues, or should this report be closed?
"g++ -E -" compiles as C (see PR 67023)
It's till set:
$ g++ -x c++ -E -dM - </dev/null | fgrep GNU
#define __GNUC_PATCHLEVEL__ 0
#define __GNUC__ 7
#define __GNUG__ 7
#define __GNUC_STDC_INLINE__ 1
#define __GNUC_MINOR__ 0
#define _GNU_SOURCE 1