]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR c++/84785 - ICE with alias template and default targs.
authorJason Merrill <jason@redhat.com>
Sat, 10 Mar 2018 03:35:25 +0000 (22:35 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 10 Mar 2018 03:35:25 +0000 (22:35 -0500)
* pt.c (type_unification_real): Set processing_template_decl if
saw_undeduced == 1.

From-SVN: r258410

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp0x/alias-decl-63.C [new file with mode: 0644]

index 763a6947ec25605dff8852625b447eecc5dbfed4..527ed0e4adeda9521161c2c81afbf47d10093319 100644 (file)
@@ -1,3 +1,9 @@
+2018-03-09  Jason Merrill  <jason@redhat.com>
+
+       PR c++/84785 - ICE with alias template and default targs.
+       * pt.c (type_unification_real): Set processing_template_decl if
+       saw_undeduced == 1.
+
 2018-03-03  Jason Merrill  <jason@redhat.com>
 
        PR c++/84686 - missing volatile loads.
index 27e4c84ac79994a0377808bb1b47a1b848524e2f..423d92c66f465266b86c41565189b78cad14943c 100644 (file)
@@ -18602,7 +18602,13 @@ type_unification_real (tree tparms,
          location_t save_loc = input_location;
          if (DECL_P (parm))
            input_location = DECL_SOURCE_LOCATION (parm);
+
+         if (saw_undeduced == 1)
+           ++processing_template_decl;
          arg = tsubst_template_arg (arg, targs, complain, NULL_TREE);
+         if (saw_undeduced == 1)
+           --processing_template_decl;
+
          if (arg != error_mark_node && !uses_template_parms (arg))
            arg = convert_template_argument (parm, arg, targs, complain,
                                             i, NULL_TREE);
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-63.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-63.C
new file mode 100644 (file)
index 0000000..04fb42d
--- /dev/null
@@ -0,0 +1,18 @@
+// PR c++/84785
+// { dg-do compile { target c++11 } }
+
+template <typename> struct A;
+template <bool> struct B;
+template <bool B, typename> using enable_if_t = typename B<B>::type;
+template <long> using type_pack_element = int;
+struct variant {
+  variant() {}
+  template <typename Arg, long I = Arg::type::value,
+            typename = type_pack_element<I>, enable_if_t<A<Arg>::value, int>>
+  variant(Arg &&);
+};
+
+struct S {
+  variant var;
+};
+int main() { S s; }