https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88795
--- Comment #4 from David Malcolm <dmalcolm at gcc dot gnu.org> --- Author: dmalcolm Date: Tue Jan 15 23:29:15 2019 New Revision: 267957 URL: https://gcc.gnu.org/viewcvs?rev=267957&root=gcc&view=rev Log: Fix ICE on class-template argument deduction (PR c++/88795) PR c++/88795 reports an ICE building a function_type for a deduction guide when the substitution into the function signature fails, due to an error_mark_node being returned from tsubst_arg_types but not being checked for. This error_mark_node gets used as the TYPE_ARG_TYPES, leading to ICEs in various places that assume this is a TREE_LIST. This patch checks the result of tsubst_arg_types and propagates the failure if it returns error_mark_node. It also adds an assertion to build_function_type, to fail faster if passed in error_mark_node. gcc/cp/ChangeLog: PR c++/88795 * pt.c (build_deduction_guide): Bail out if tsubst_arg_types fails. gcc/testsuite/ChangeLog: PR c++/88795 * g++.dg/template/pr88795.C: New test. gcc/ChangeLog: PR c++/88795 * tree.c (build_function_type): Assert that arg_types is not error_mark_node. Added: trunk/gcc/testsuite/g++.dg/template/pr88795.C Modified: trunk/gcc/ChangeLog trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c trunk/gcc/testsuite/ChangeLog trunk/gcc/tree.c