Standard C++ does not include hexadecimal floating point numbers. The preprocessor correctly pedwarns for C++ if such a preprocessing token is converted to a token, but it incorrectly allows p+ and p- in preprocessing tokens in standard C++ mode in the first place. The problem is probably the table
static const struct lang_flags lang_defaults[] = { /* c99 c++ xnum std // digr */ /* CXX98 */ { 0, 1, 1, 1, 1, 1 }, in libcpp/init.c: xnum should be 0 not 1. The valid C++ testcases this affects (compile with -std=c++98 -pedantic-errors, should execute OK, instead aborts) are along the lines of gcc.dg/c90-hexfloat-2.c: #define f ( #define l ) #define str(x) #x #define xstr(x) str(x) /* C90 and C++: "0x1p+( 0x1p+)"; C99: "0x1p+f 0x1p+l" */ const char *s = xstr(0x1p+f 0x1p+l); extern "C" void abort (void); extern "C" int strcmp (const char *, const char *); int main (void) { if (strcmp (s, "0x1p+( 0x1p+)")) abort (); else return 0; /* Correct C90 and C++ behavior. */ } -- Summary: standard C++ should not have hex float preprocessing tokens Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: preprocessor AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jsm28 at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23827