re PR c++/89390 (ICE in get_string, at spellcheck-tree.h:46)
authorJakub Jelinek <jakub@redhat.com>
Tue, 19 Feb 2019 08:38:54 +0000 (09:38 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 19 Feb 2019 08:38:54 +0000 (09:38 +0100)
PR c++/89390
* error.c (qualified_name_lookup_error): Only call
suggest_alternative_in_scoped_enum if name is IDENTIFIER_NODE.

* g++.dg/diagnostic/pr89390.C: New test.

From-SVN: r269007

gcc/cp/ChangeLog
gcc/cp/error.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/diagnostic/pr89390.C [new file with mode: 0644]

index e2b9be50ff15c9f030af54438c9a6795fda3cf48..21979b564f8f53eaf3b932843a30375db3e98dfc 100644 (file)
@@ -1,3 +1,9 @@
+2019-02-19  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/89390
+       * error.c (qualified_name_lookup_error): Only call
+       suggest_alternative_in_scoped_enum if name is IDENTIFIER_NODE.
+
 2019-02-19  Tom Honermann  <tom@honermann.net>
 
        * name-lookup.c (get_std_name_hint): Added u8string as a name hint.
index f585d5fe58fe9ce03329f70aea8bc579da84c222..dd3a339a2378ba49bb3a985f58256e8b26bfa6df 100644 (file)
@@ -4276,7 +4276,7 @@ qualified_name_lookup_error (tree scope, tree name,
       else
        {
          name_hint hint;
-         if (SCOPED_ENUM_P (scope))
+         if (SCOPED_ENUM_P (scope) && TREE_CODE (name) == IDENTIFIER_NODE)
            hint = suggest_alternative_in_scoped_enum (name, scope);
          if (const char *suggestion = hint.suggestion ())
            {
index 41375758005e575bc851a3bd22c9fae7c5396a0d..d12d51ff2d6c72efb2ad840f124e7fe9deb9116b 100644 (file)
@@ -1,3 +1,8 @@
+2019-02-19  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/89390
+       * g++.dg/diagnostic/pr89390.C: New test.
+
 2019-02-18  Sharon Dvir  <unapologtic@gmail.com>
 
        * README: Fix typos.
diff --git a/gcc/testsuite/g++.dg/diagnostic/pr89390.C b/gcc/testsuite/g++.dg/diagnostic/pr89390.C
new file mode 100644 (file)
index 0000000..8dae827
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/89390
+// { dg-do compile { target c++11 } }
+
+enum class A { B, C };
+
+void
+foo ()
+{
+  A::~A ();    // { dg-error "'~A' is not a member of 'A'" "" { target *-*-* } 0 }
+}