From c286fb4ed5706cb4de40da0eb798e31bb16eb05b Mon Sep 17 00:00:00 2001 From: Andrew Sutton Date: Tue, 19 Nov 2019 15:26:16 +0000 Subject: [PATCH] re PR c++/89913 (ICE with invalid using declaration) PR c++/89913 gcc/cp/ * pt.c (get_underlying_template): Exit loop if the original type of the alias is null. gcc/testsuite/ * g++.dg/cpp2a/pr89913.C: New test. From-SVN: r278451 --- gcc/cp/ChangeLog | 12 ++++++++++++ gcc/cp/pt.c | 3 +++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp2a/pr89913.C | 6 ++++++ 4 files changed, 26 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp2a/pr89913.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 08b44c5..cc7a58e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,15 @@ +2019-11-15 Andrew Sutton + + PR c++/89913 + * pt.c (get_underlying_template): Exit loop if the original type + of the alias is null. + +2019-11-19 Andrew Sutton + + PR c++/92078 + * pt.c (maybe_new_partial_specialization): Apply access to newly + created partial specializations. Update comment style. + 2019-11-19 Andrew Sutton PR c++/92078 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 59f9d03..064fe5b 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -6395,6 +6395,9 @@ get_underlying_template (tree tmpl) { /* Determine if the alias is equivalent to an underlying template. */ tree orig_type = DECL_ORIGINAL_TYPE (DECL_TEMPLATE_RESULT (tmpl)); + /* The underlying type may have been ill-formed. Don't proceed. */ + if (!orig_type) + break; tree tinfo = TYPE_TEMPLATE_INFO_MAYBE_ALIAS (orig_type); if (!tinfo) break; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index edbf126..13ce849 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-11-15 Andrew Sutton + + PR c++/89913 + * g++.dg/cpp2a/pr89913.C: New test. + 2019-11-19 Andrew Sutton PR c++/92078 diff --git a/gcc/testsuite/g++.dg/cpp2a/pr89913.C b/gcc/testsuite/g++.dg/cpp2a/pr89913.C new file mode 100644 index 0000000..c06847e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/pr89913.C @@ -0,0 +1,6 @@ +// { dg-do compile { target c++2a } } + +template using A = auto; // { dg-error "not allowed" } +// In pre-20, the error is "invalid use of auto" + +template using B = A; -- 2.7.4