[Bug c++/11196] New: parse error before numeric constant

is88071@cis.nctu.edu.tw gcc-bugzilla@gcc.gnu.org
Sun Jun 15 17:24:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11196

           Summary: parse error before numeric constant
           Product: gcc
           Version: 3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: is88071@cis.nctu.edu.tw
                CC: gcc-bugs@gcc.gnu.org

preprocessor error!

I wrote a simple C++ programing using GCC 3.2-cygwin, MingW, Linux, etc version
as below.
===================
#include<iostream>
using namespace std;

const double M_PI = 3.1415;

int main()
{
    cout << M_PI << endl;
    return 0;
}
===================

There're a parsing error in "M_PI". It has been defined in cmath(math.h) as:
#define M_PI 3.14159265358979323846

But, I didn't include the <cmath> header file. After undefined the M_PI, no
error be found. I think it's an error of preprocessor of GCC. 

For addition, I just included <iostream> header file, I can use all of methods
declared in <cmath> header file. It's no compiling error on 2.95 or older
version of GCC.



More information about the Gcc-bugs mailing list