From 05f9a806ee423a6dc7995c1c1bfe18c97c80c5c4 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Tue, 5 Jun 2018 13:11:00 +0000 Subject: [PATCH] re PR c++/85976 (ICE in cp_tree_equal when building Blitz. May be nested templates.) PR c++/85976 * tree.c (cp_tree_equal): Handle USING_DECL. * g++.dg/cpp0x/alias-decl-64.C: New test. From-SVN: r261200 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/tree.c | 8 ++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/alias-decl-64.C | 15 +++++++++++++++ 4 files changed, 33 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-64.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f4fa21a7a97..4962eacf5fc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2018-06-05 Marek Polacek + + PR c++/85976 + * tree.c (cp_tree_equal): Handle USING_DECL. + 2018-06-05 Jason Merrill PR c++/85731 - wrong error with qualified-id in template. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index c5b6e9689b6..bbbda7e98b6 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -3878,6 +3878,14 @@ 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; + default: break; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2cacaa2931d..a049d14e886 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-06-05 Marek Polacek + + PR c++/85976 + * g++.dg/cpp0x/alias-decl-64.C: New test. + 2018-06-05 Richard Biener PR tree-optimization/86046 diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-64.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-64.C new file mode 100644 index 00000000000..019eb269750 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-64.C @@ -0,0 +1,15 @@ +// PR c++/85976 +// { dg-do compile { target c++11 } } + +template class A; +template class B; +template struct C; +template class D { + using B::rank_; + void operator()(typename C>::i); +}; + +template class F { + using B::rank_; + void operator()(typename C>::i); +}; -- 2.30.2