aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-04-21 06:46:42 -0700
committerNathan Sidwell <nathan@acm.org>2020-04-21 06:50:36 -0700
commitf2c8be187e8eb061e44166ac41646285821be6a6 (patch)
treec8baa0d930c4da9f136719fcb48c3445539bf09f /gcc/cp/pt.c
parent15256c8a8ac6573d250506c40dbe13082186c2aa (diff)
downloadgcc-f2c8be187e8eb061e44166ac41646285821be6a6.zip
gcc-f2c8be187e8eb061e44166ac41646285821be6a6.tar.gz
gcc-f2c8be187e8eb061e44166ac41646285821be6a6.tar.bz2
c++: ICE with ptr_plus_expr
An ICE on darwin, when a SFINAE-context substitution produced error_mark_node foo an operand of a POINTER_PLUS_EXPR. fold_build_pointer_plus is unprepared to deal with that, so we need to check earlier. We had no luck reducing the testcase to something manageable. * pt.c (tsubst_copy_and_build) [POINTER_PLUS_EXPR]: Check for error_mark_node.
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index cd6392a..6f74c27 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -19409,7 +19409,11 @@ tsubst_copy_and_build (tree t,
case POINTER_PLUS_EXPR:
{
tree op0 = RECUR (TREE_OPERAND (t, 0));
+ if (op0 == error_mark_node)
+ RETURN (error_mark_node);
tree op1 = RECUR (TREE_OPERAND (t, 1));
+ if (op1 == error_mark_node)
+ RETURN (error_mark_node);
RETURN (fold_build_pointer_plus (op0, op1));
}