re PR c++/89913 (ICE with invalid using declaration)
authorAndrew Sutton <asutton@lock3software.com>
Tue, 19 Nov 2019 15:26:16 +0000 (15:26 +0000)
committerAndrew Sutton <asutton@gcc.gnu.org>
Tue, 19 Nov 2019 15:26:16 +0000 (15:26 +0000)
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
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp2a/pr89913.C [new file with mode: 0644]

index 08b44c57b33bab990cf7d3781534168641b43ca9..cc7a58ec5fd98f676a1a73c92c49c1ef2491789a 100644 (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
index 59f9d03a4bca8ec148dd527e3525d8d122729639..064fe5be8b245de3a8e66da60e3c7898cad97de8 100644 (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;
index edbf126e1378c7fd247d902fa2cc62f944cd32a6..13ce849eff23168c4af355ac070825919c290d82 100644 (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
diff --git a/gcc/testsuite/g++.dg/cpp2a/pr89913.C b/gcc/testsuite/g++.dg/cpp2a/pr89913.C
new file mode 100644 (file)
index 0000000..c06847e
--- /dev/null
@@ -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...>;