Message ID | 20180119132815.GF3914@redhat.com |
---|---|
State | New |
Headers | show |
Series | Small C++ tweak to fold_simple | expand |
On Fri, Jan 19, 2018 at 8:28 AM, Marek Polacek <polacek@redhat.com> wrote: > fold_simple struck me as odd, certainly the NULL_TREE assignment is > unnecessary, so this patch simplifies it a bit. OK. > I've been confused about the commentary too, what is the difference between > "constant-expressions" and "constexpressions"? We should clarify that. I have no idea, I think it's probably an editing mistake that can be removed. Jason
diff --git gcc/cp/constexpr.c gcc/cp/constexpr.c index 9a548d29bbc..ca7f369f7e9 100644 --- gcc/cp/constexpr.c +++ gcc/cp/constexpr.c @@ -4931,22 +4931,21 @@ fold_simple_1 (tree t) } /* If T is a simple constant expression, returns its simplified value. - Otherwise returns T. In contrast to maybe_constant_value do we + Otherwise returns T. In contrast to maybe_constant_value we simplify only few operations on constant-expressions, and we don't try to simplify constexpressions. */ tree fold_simple (tree t) { - tree r = NULL_TREE; if (processing_template_decl) return t; - r = fold_simple_1 (t); - if (!r) - r = t; + tree r = fold_simple_1 (t); + if (r) + return r; - return r; + return t; } /* If T is a constant expression, returns its reduced value.