===================================================================
@@ -5916,6 +5916,8 @@ 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));
+ if (!orig_type)
+ break;
tree tinfo = TYPE_TEMPLATE_INFO_MAYBE_ALIAS (orig_type);
if (!tinfo)
break;
===================================================================
@@ -0,0 +1,13 @@
+// PR c++/78765
+// { dg-do compile { target c++11 } }
+
+template <template <typename ...> class TT>
+struct quote {
+ template <typename ...Ts>
+ using apply = TT<Ts...>; // { dg-error "pack expansion" }
+};
+
+template <typename>
+using to_int_t = int;
+
+using t = quote<quote<to_int_t>::apply>::apply<int>;