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
This commit is contained in:
Andrew Sutton 2019-11-19 15:26:16 +00:00 committed by Andrew Sutton
parent cce3c9db9e
commit c286fb4ed5
4 changed files with 26 additions and 0 deletions

View File

@ -1,3 +1,15 @@
2019-11-15 Andrew Sutton <asutton@lock3software.com>
PR c++/89913
* pt.c (get_underlying_template): Exit loop if the original type
of the alias is null.
2019-11-19 Andrew Sutton <asutton@lock3software.com>
PR c++/92078
* pt.c (maybe_new_partial_specialization): Apply access to newly
created partial specializations. Update comment style.
2019-11-19 Andrew Sutton <asutton@lock3software.com>
PR c++/92078

View File

@ -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;

View File

@ -1,3 +1,8 @@
2019-11-15 Andrew Sutton <asutton@lock3software.com>
PR c++/89913
* g++.dg/cpp2a/pr89913.C: New test.
2019-11-19 Andrew Sutton <asutton@lock3software.com>
PR c++/92078

View File

@ -0,0 +1,6 @@
// { dg-do compile { target c++2a } }
template<typename...> using A = auto; // { dg-error "not allowed" }
// In pre-20, the error is "invalid use of auto"
template<typename... T> using B = A<T...>;