I steered Marek wrong on PR 85976; even though these two using-declarations
have the same effect, they are not the same declaration, and we don't need to
work to treat them as the same like we do for typedefs, so this goes back to
the patch he initially sent.

If we did need to treat them as the same, we would need to handle them
specially in iterative_hash_template_arg as well as here.

Tested x86_64-pc-linux-gnu, applying to trunk.

        * tree.c (cp_tree_equal): Always return false for USING_DECL.
---
 gcc/cp/tree.c    | 9 +--------
 gcc/cp/ChangeLog | 3 +++
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index af077e795cf..718eed349c6 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -3661,6 +3661,7 @@ cp_tree_equal (tree t1, tree t2)
     case TEMPLATE_DECL:
     case IDENTIFIER_NODE:
     case SSA_NAME:
+    case USING_DECL:
       return false;
 
     case BASELINK:
@@ -3787,14 +3788,6 @@ cp_tree_equal (tree t1, tree t2)
                                     DEFERRED_NOEXCEPT_ARGS (t2)));
       break;
 
-    case USING_DECL:
-      if (DECL_DEPENDENT_P (t1) && DECL_DEPENDENT_P (t2))
-       return (cp_tree_equal (USING_DECL_SCOPE (t1),
-                              USING_DECL_SCOPE (t2))
-               && cp_tree_equal (DECL_NAME (t1),
-                                 DECL_NAME (t2)));
-      return false;
-
     case LAMBDA_EXPR:
       /* Two lambda-expressions are never considered equivalent.  */
       return false;
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d4dc5d7146a..76bc8ffaa68 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
 2019-03-18  Jason Merrill  <ja...@redhat.com>
 
+       PR c++/89630 - ICE with dependent using-decl as template arg.
+       * tree.c (cp_tree_equal): Always return false for USING_DECL.
+
        PR c++/89761 - ICE with sizeof... in pack expansion.
        * pt.c (argument_pack_element_is_expansion_p): Handle
        ARGUMENT_PACK_SELECT.

base-commit: c821b0ef575ab53abd3037cf288a6b7b40b99d12
-- 
2.20.1

Reply via email to