Commit e30947eb by Jakub Jelinek Committed by Jakub Jelinek

re PR preprocessor/83602 (ICE in cpp_macro_definition_location(cpp_hashnode*) on invalid code)

	PR preprocessor/83602
	* name-lookup.c (lookup_name_fuzzy): Don't use macro_use_before_def
	for builtin macros.

	* g++.dg/cpp/pr83602.C: New test.

From-SVN: r256175
parent 19c37faa
2018-01-03 Jakub Jelinek <jakub@redhat.com> 2018-01-03 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/83602
* name-lookup.c (lookup_name_fuzzy): Don't use macro_use_before_def
for builtin macros.
PR c++/83634 PR c++/83634
* cp-gimplify.c (cp_fold) <case NOP_EXPR>: If the operand folds to * cp-gimplify.c (cp_fold) <case NOP_EXPR>: If the operand folds to
error_mark_node, return error_mark_node. error_mark_node, return error_mark_node.
......
...@@ -5757,7 +5757,7 @@ lookup_name_fuzzy (tree name, enum lookup_name_fuzzy_kind kind, location_t loc) ...@@ -5757,7 +5757,7 @@ lookup_name_fuzzy (tree name, enum lookup_name_fuzzy_kind kind, location_t loc)
/* If we have an exact match for a macro name, then the /* If we have an exact match for a macro name, then the
macro has been used before it was defined. */ macro has been used before it was defined. */
cpp_hashnode *macro = bmm.blithely_get_best_candidate (); cpp_hashnode *macro = bmm.blithely_get_best_candidate ();
if (macro) if (macro && (macro->flags & NODE_BUILTIN) == 0)
return name_hint (NULL, return name_hint (NULL,
new macro_use_before_def (loc, macro)); new macro_use_before_def (loc, macro));
} }
......
2018-01-03 Jakub Jelinek <jakub@redhat.com> 2018-01-03 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/83602
* g++.dg/cpp/pr83602.C: New test.
PR c++/83634 PR c++/83634
* g++.dg/parse/pr83634.C: New test. * g++.dg/parse/pr83634.C: New test.
......
// PR preprocessor/83602
// { dg-do compile }
_Pragma // { dg-error "_Pragma" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment