diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 4b71e199d27..32640f8e946 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -30031,6 +30031,8 @@ build_deduction_guide (tree type, tree ctor, tree outer_args, tsubst_flags_t com references to members of an unknown specialization. */ cp_evaluated ev; fparms = tsubst_arg_types (fparms, targs, NULL_TREE, complain, ctor); + if (fparms == error_mark_node) + ok = false; fargs = tsubst (fargs, targs, complain, ctor); if (ci) { diff --git a/gcc/testsuite/g++.dg/parse/error66.C b/gcc/testsuite/g++.dg/parse/error66.C new file mode 100644 index 00000000000..82f4b8b8a53 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/error66.C @@ -0,0 +1,6 @@ +// PR c++/105760 +// { dg-do compile { target c++17 } } + +template // { dg-error "must be at the end of the template parameter list" } +struct A { A(Ts...); }; +A a;