From 5a5e54cdf872f476a2412f317f8744b13774b3ff Mon Sep 17 00:00:00 2001 From: Kai Tietz Date: Fri, 12 Dec 2014 18:14:54 +0100 Subject: [PATCH] re PR c++/63996 (Infinite loop in invalid C++14 constexpr fn) PR c++/63996 * constexpr.c (cxx_eval_loop_expr): Don't loop endless on none-constant expression. From-SVN: r218682 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/constexpr.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1809b26a010..3de8861f792 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2014-12-12 Kai Tietz + + PR c++/63996 + * constexpr.c (cxx_eval_loop_expr): Don't loop + endless on none-constant expression. + 2014-12-12 Jason Merrill PR c++/61402 diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 9426d8558e2..732a79cdf18 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -2841,7 +2841,7 @@ cxx_eval_loop_expr (const constexpr_ctx *ctx, tree t, { cxx_eval_statement_list (ctx, body, non_constant_p, overflow_p, jump_target); - if (returns (jump_target) || breaks (jump_target)) + if (returns (jump_target) || breaks (jump_target) || *non_constant_p) break; } if (breaks (jump_target)) -- 2.30.2