$ cat t.c int main (void) { _Complex float z; z = _Complex (1.90000007326203904e+19, 0.0); z = _Complex (1.0e+0, 0.0) / z; $ ./cc1 -quiet t.c t.c: In function 'main': t.c:6: error: expected expression before '__complex__' t.c:7: error: expected expression before '__complex__' $ ./cc1 --version GNU C version 4.2.0 20060624 (experimental) (x86_64-unknown-linux-gnu) compiled by GNU C version 4.0.2 20050901 (prerelease) (SUSE Linux). GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 $
Confirmed, we don't record in the preprocessor which keyword is used, _Complex is treated the same as __complex__. There is another bug about a similar issue with "or" and |.
PR 14875 is the related bug.
Subject: Re: Diagnostic about wrong use _Complex prints __complex__ "pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes: | Confirmed, we don't record in the preprocessor which keyword is | used, _Complex is treated the same as __complex__. Indeed. However, we can approximate a fix by testing whether we're compiling under C99, GNU99, or just C90, or C++. -- gaby
(In reply to comment #3) > Indeed. However, we can approximate a fix by testing whether we're > compiling under C99, GNU99, or just C90, or C++. That would not work as _Complex is accepted in GNU90 more and with the C++ front-end by default. In fact "_Complex float t;" is accepted with the C++ front-end even with -pedantic which seems wrong and that would be a different but.
Subject: Re: Diagnostic about wrong use _Complex prints __complex__ "pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes: | (In reply to comment #3) | > Indeed. However, we can approximate a fix by testing whether we're | > compiling under C99, GNU99, or just C90, or C++. | | That would not work as _Complex is accepted in GNU90 more and with the C++ | front-end by default. Lookup the meaning of "approximation". -- Gaby
Subject: Bug 28152 Author: manu Date: Thu Aug 14 13:01:58 2008 New Revision: 139097 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=139097 Log: 2008-08-08 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR c/28152 * c-parser.c (c_lex_one_token): Do not store the canonical spelling for keywords. testsuite/ * gcc.dg/parser-pr28152.c: New. * gcc.dg/parser-pr28152-2.c: New. Added: trunk/gcc/testsuite/gcc.dg/parser-pr28152-2.c trunk/gcc/testsuite/gcc.dg/parser-pr28152.c Modified: trunk/gcc/ChangeLog trunk/gcc/c-parser.c trunk/gcc/testsuite/ChangeLog
This is FIXED for C but not for C++. Probably this is the same bug as 14875 but just in case, I keep open both.
Patch here: http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00874.html
Subject: Bug 28152 Author: manu Date: Mon May 4 12:47:53 2009 New Revision: 147097 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147097 Log: 2009-05-04 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR c++/28152 cp/ * parser.c (cp_lexer_get_preprocessor_token): Do not store the canonical spelling for keywords. (cp_parser_attribute_list): Use the canonical spelling for keywords in attributes. testsuite/ * g++.dg/parse/parser-pr28152.C: New. * g++.dg/parse/parser-pr28152-2.C: New. Added: trunk/gcc/testsuite/g++.dg/parse/parser-pr28152-2.C trunk/gcc/testsuite/g++.dg/parse/parser-pr28152.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
FIXED in GCC 4.5