aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2019-01-15 23:29:15 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2019-01-15 23:29:15 +0000
commit1abb44f863d32ef738d28144d2c984603e27721a (patch)
tree763017fbe03c5c3da080d2a793ac9c587929f4f1 /gcc/tree.c
parentb7ec44e82bb50bd3adc294aa7e87252c79ea7294 (diff)
downloadgcc-1abb44f863d32ef738d28144d2c984603e27721a.zip
gcc-1abb44f863d32ef738d28144d2c984603e27721a.tar.gz
gcc-1abb44f863d32ef738d28144d2c984603e27721a.tar.bz2
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. From-SVN: r267957
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 2e112ee..9e55499 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -8455,6 +8455,8 @@ build_function_type (tree value_type, tree arg_types)
bool any_structural_p, any_noncanonical_p;
tree canon_argtypes;
+ gcc_assert (arg_types != error_mark_node);
+
if (TREE_CODE (value_type) == FUNCTION_TYPE)
{
error ("function return type cannot be function");