From 5ec1701eae7178a140be621ac5aec4e40c1070b5 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Mon, 21 Aug 2017 13:29:20 +0000 Subject: [PATCH] re PR c++/81899 (ICE: Segmentation fault) PR c++/81899 * pt.c (instantiate_class_template_1): BOUND_TEMPLATE_TEMPLATE_PARM is never friend-injected. PR c++/81899 * g++.dg/template/pr81899.C: New. From-SVN: r251227 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/template/pr81899.C | 11 +++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/template/pr81899.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 72a05547ed2..ba9583aa3b3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-08-21 Nathan Sidwell + + PR c++/81899 + * pt.c (instantiate_class_template_1): + BOUND_TEMPLATE_TEMPLATE_PARM is never friend-injected. + 2017-08-18 David Malcolm PR c++/81514 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index bf1f75de1e7..8d816c73244 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -10724,7 +10724,8 @@ instantiate_class_template_1 (tree type) adjust_processing_template_decl = true; --processing_template_decl; } - else if (!CLASSTYPE_USE_TEMPLATE (friend_type) + else if (TREE_CODE (friend_type) != BOUND_TEMPLATE_TEMPLATE_PARM + && !CLASSTYPE_USE_TEMPLATE (friend_type) && TYPE_HIDDEN_P (friend_type)) { /* friend class C; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 53505ef21f4..f35db2b3524 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-08-21 Nathan Sidwell + + PR c++/81899 + * g++.dg/template/pr81899.C: New. + 2017-08-21 Richard Biener PR tree-optimization/81900 diff --git a/gcc/testsuite/g++.dg/template/pr81899.C b/gcc/testsuite/g++.dg/template/pr81899.C new file mode 100644 index 00000000000..2db57cf7504 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/pr81899.C @@ -0,0 +1,11 @@ +// PR 81899 we tried to treat a bound-tpl-tpl-parm as-if a real record-type + +template