re PR preprocessor/83602 (ICE in cpp_macro_definition_location(cpp_hashnode*) on...
authorJakub Jelinek <jakub@redhat.com>
Wed, 3 Jan 2018 12:17:05 +0000 (13:17 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 3 Jan 2018 12:17:05 +0000 (13:17 +0100)
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

gcc/cp/ChangeLog
gcc/cp/name-lookup.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp/pr83602.C [new file with mode: 0644]

index 9dfb293e7f3c6056f264ae4d10c11f02ceb5fa81..2fe42b2bb92a077a669369c332639f7dcc2c5556 100644 (file)
@@ -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.
index 95fa52b34b11c50c02902080fe0cd0f96d08fd25..cddafab29fe642bb1a73b59e051c930fbaea08bc 100644 (file)
@@ -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));
     }
index cff788b6a925848669f19609982fa29655fd0129..d2c1c96ccdbbab8ac4cc5dc49146bae24059e50a 100644 (file)
@@ -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 (file)
index 0000000..a07b0e4
--- /dev/null
@@ -0,0 +1,4 @@
+// PR preprocessor/83602
+// { dg-do compile }
+
+_Pragma        // { dg-error "_Pragma" }