re PR c++/84537 (ICE in get_string, at spellcheck-tree.h)
authorMarek Polacek <polacek@redhat.com>
Mon, 26 Feb 2018 14:12:25 +0000 (14:12 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Mon, 26 Feb 2018 14:12:25 +0000 (14:12 +0000)
PR c++/84537
* name-lookup.c (suggest_alternative_in_explicit_scope): Return false
if name is error node.

* g++.dg/parse/error60.C: New test.

From-SVN: r257988

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

index cb0dcd7c43ebe0e47ba03a4678d5d7b71abdb17b..d824175aafc1d8bfdefb6d338350952dedc4c8c3 100644 (file)
@@ -1,3 +1,9 @@
+2018-02-26  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/84537
+       * name-lookup.c (suggest_alternative_in_explicit_scope): Return false
+       if name is error node.
+
 2018-02-25  Jason Merrill  <jason@redhat.com>
 
        PR c++/84015 - ICE with class deduction and auto template parm.
index 9117e0b30ebb46794317bce0b645cfce5795cce1..0f00328e96e310aacbc634de81e403eb9cca8134 100644 (file)
@@ -5541,6 +5541,10 @@ bool
 suggest_alternative_in_explicit_scope (location_t location, tree name,
                                       tree scope)
 {
+  /* Something went very wrong; don't suggest anything.  */
+  if (name == error_mark_node)
+    return false;
+
   /* Resolve any namespace aliases.  */
   scope = ORIGINAL_NAMESPACE (scope);
 
index ba3101dd634d66b4b8977095e28fa5680c758f76..8c16b19f04a6bcff90cbb75c2cacc0c60e0822c9 100644 (file)
@@ -1,3 +1,8 @@
+2018-02-26  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/84537
+       * g++.dg/parse/error60.C: New test.
+
 2018-02-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/84556
diff --git a/gcc/testsuite/g++.dg/parse/error60.C b/gcc/testsuite/g++.dg/parse/error60.C
new file mode 100644 (file)
index 0000000..38f4e34
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/84537
+// { dg-do compile }
+
+namespace N
+{
+  template<int> struct A {};
+}
+
+N::template A<> a; // { dg-error "" }