aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/expr.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-06-22 17:57:07 -0400
committerJason Merrill <jason@gcc.gnu.org>2018-06-22 17:57:07 -0400
commite56f662950ce31be414d64699b369ad9a5aca556 (patch)
tree3c353035edc43d26c7a4f038fcd1cd043b06b82e /gcc/cp/expr.c
parente4511ca2e9ecdb51d41b64452398f8e2df575668 (diff)
downloadgcc-e56f662950ce31be414d64699b369ad9a5aca556.zip
gcc-e56f662950ce31be414d64699b369ad9a5aca556.tar.gz
gcc-e56f662950ce31be414d64699b369ad9a5aca556.tar.bz2
PR c++/86219 - ICE with erroneous initializer in template.
* constexpr.c (fold_non_dependent_expr): Add complain parm. * call.c, expr.c, init.c, pt.c, semantics.c, typeck.c, typeck2.c: Pass it. * call.c (build_cxx_call): Don't mess with builtins in a template. * typeck2.c (store_init_value): If fold_non_dependent_expr didn't produce a constant value, go back to the uninstantiated form. From-SVN: r261972
Diffstat (limited to 'gcc/cp/expr.c')
-rw-r--r--gcc/cp/expr.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/cp/expr.c b/gcc/cp/expr.c
index 133a01b..93477bc 100644
--- a/gcc/cp/expr.c
+++ b/gcc/cp/expr.c
@@ -353,7 +353,13 @@ fold_for_warn (tree x)
/* It's not generally safe to fully fold inside of a template, so
call fold_non_dependent_expr instead. */
if (processing_template_decl)
- return fold_non_dependent_expr (x);
+ {
+ tree f = fold_non_dependent_expr (x, tf_none);
+ if (f == error_mark_node)
+ return x;
+ else
+ return f;
+ }
return c_fully_fold (x, /*for_init*/false, /*maybe_constp*/NULL);
}