From: jakub Date: Wed, 3 Jan 2018 12:17:05 +0000 (+0000) Subject: PR preprocessor/83602 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1f04fdffb557c04ef13061994d412244795bf51b;p=thirdparty%2Fgcc.git 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@256175 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9dfb293e7f3c..2fe42b2bb92a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2018-01-03 Jakub Jelinek + PR preprocessor/83602 + * name-lookup.c (lookup_name_fuzzy): Don't use macro_use_before_def + for builtin macros. + PR c++/83634 * cp-gimplify.c (cp_fold) : If the operand folds to error_mark_node, return error_mark_node. diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 95fa52b34b11..cddafab29fe6 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -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 macro has been used before it was defined. */ cpp_hashnode *macro = bmm.blithely_get_best_candidate (); - if (macro) + if (macro && (macro->flags & NODE_BUILTIN) == 0) return name_hint (NULL, new macro_use_before_def (loc, macro)); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cff788b6a925..d2c1c96ccdbb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2018-01-03 Jakub Jelinek + PR preprocessor/83602 + * g++.dg/cpp/pr83602.C: New test. + PR c++/83634 * g++.dg/parse/pr83634.C: New test. diff --git a/gcc/testsuite/g++.dg/cpp/pr83602.C b/gcc/testsuite/g++.dg/cpp/pr83602.C new file mode 100644 index 000000000000..a07b0e4af591 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp/pr83602.C @@ -0,0 +1,4 @@ +// PR preprocessor/83602 +// { dg-do compile } + +_Pragma // { dg-error "_Pragma" }