re PR c++/28152 (Diagnostic about wrong use _Complex prints __complex__)

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.

From-SVN: r147097
This commit is contained in:
Manuel López-Ibáñez 2009-05-04 12:47:53 +00:00
parent a3af5087d9
commit 67beaaa685
5 changed files with 46 additions and 6 deletions

View File

@ -1,3 +1,11 @@
2009-05-04 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c++/28152
* 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.
2009-05-01 Joseph Myers <joseph@codesourcery.com>
* cxx-pretty-print.c (is_destructor_name, pp_cxx_unqualified_id,

View File

@ -418,11 +418,6 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer, cp_token *token)
token->type = CPP_KEYWORD;
/* Record which keyword. */
token->keyword = C_RID_CODE (token->u.value);
/* Update the value. Some keywords are mapped to particular
entities, rather than simply having the value of the
corresponding IDENTIFIER_NODE. For example, `__const' is
mapped to `const'. */
token->u.value = ridpointers[token->keyword];
}
else
{
@ -16842,7 +16837,12 @@ cp_parser_attribute_list (cp_parser* parser)
/* Save away the identifier that indicates which attribute
this is. */
identifier = token->u.value;
identifier = (token->type == CPP_KEYWORD)
/* For keywords, use the canonical spelling, not the
parsed identifier. */
? ridpointers[(int) token->keyword]
: token->u.value;
attribute = build_tree_list (identifier, NULL_TREE);
/* Peek at the next token. */

View File

@ -1,3 +1,9 @@
2009-05-04 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c++/28152
* g++.dg/parse/parser-pr28152.C: New.
* g++.dg/parse/parser-pr28152-2.C: New.
2009-05-04 Joseph Myers <joseph@codesourcery.com>
* gcc.dg/attr-alias-5.c, gcc.dg/ucnid-7.c: New tests.

View File

@ -0,0 +1,13 @@
/* PR 28152: error messages should mention __complex__ */
/* { dg-do compile } */
/* { dg-options "" } */
int
main (void)
{
__complex__ float z;
z = __complex__ (1.90000007326203904e+19, 0.0); // { dg-error "expected primary-expression before '__complex__'" }
// { dg-error "expected .;. before .__complex__." "" { target *-*-* } 9 }
z = __complex__ (1.0e+0, 0.0) / z; // { dg-error "expected primary-expression before '__complex__'" }
// { dg-error "expected .;. before '__complex__'" "" { target *-*-* } 11 }
// { dg-error "at end of input" "" { target *-*-* } 11 }

View File

@ -0,0 +1,13 @@
/* PR 28152: error messages should mention _Complex */
/* { dg-do compile } */
/* { dg-options "" } */
int
main (void)
{
_Complex float z;
z = _Complex (1.90000007326203904e+19, 0.0); // { dg-error "expected primary-expression before '_Complex'" }
// { dg-error "expected .;. before ._Complex." "" { target *-*-* } 9 }
z = _Complex (1.0e+0, 0.0) / z; // { dg-error "expected primary-expression before '_Complex'" }
// { dg-error "expected .;. before '_Complex'" "" { target *-*-* } 11 }
// { dg-error "at end of input" "" { target *-*-* } 11 }