aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/name-lookup.c2
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/cpp/pr83602.C4
4 files changed, 12 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9dfb293..2fe42b2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
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
* cp-gimplify.c (cp_fold) <case NOP_EXPR>: 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 95fa52b..cddafab 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 cff788b..d2c1c96 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2018-01-03 Jakub Jelinek <jakub@redhat.com>
+ 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 0000000..a07b0e4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp/pr83602.C
@@ -0,0 +1,4 @@
+// PR preprocessor/83602
+// { dg-do compile }
+
+_Pragma // { dg-error "_Pragma" }