On Thu, Apr 21, 2022 at 04:22:03PM +0200, Jakub Jelinek wrote:
> On Thu, Apr 21, 2022 at 09:20:48AM -0400, Marek Polacek via Gcc-patches wrote:
> > --- a/gcc/cp/constexpr.cc
> > +++ b/gcc/cp/constexpr.cc
> > @@ -4566,19 +4566,18 @@ cxx_eval_bit_cast (const constexpr_ctx *ctx, tree 
> > t, bool *non_constant_p,
> >  static tree
> >  cxx_eval_logical_expression (const constexpr_ctx *ctx, tree t,
> >                               tree bailout_value, tree continue_value,
> > -                        bool lval,
> > -                        bool *non_constant_p, bool *overflow_p)
> > +                        bool, bool *non_constant_p, bool *overflow_p)
> 
> Wouldn't it be better to remove the unused lval argument from
> cxx_eval_logical_expression and adjust the 2 callers?

I'm going to fix it with this patch, sorry for not doing it in the
original patch.

gcc/cp/ChangeLog:

        * constexpr.cc (cxx_eval_logical_expression): Remove unused
        parameter.
        (cxx_eval_constant_expression) <case TRUTH_ANDIF_EXPR>,
        <case TRUTH_OR_EXPR>: Adjust calls to cxx_eval_logical_expression.
---
 gcc/cp/constexpr.cc | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index fa65290e938..47d5113ace2 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -4566,7 +4566,7 @@ cxx_eval_bit_cast (const constexpr_ctx *ctx, tree t, bool 
*non_constant_p,
 static tree
 cxx_eval_logical_expression (const constexpr_ctx *ctx, tree t,
                              tree bailout_value, tree continue_value,
-                            bool, bool *non_constant_p, bool *overflow_p)
+                            bool *non_constant_p, bool *overflow_p)
 {
   tree r;
   tree lhs = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 0),
@@ -7105,7 +7105,6 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, 
tree t,
     case TRUTH_ANDIF_EXPR:
       r = cxx_eval_logical_expression (ctx, t, boolean_false_node,
                                       boolean_true_node,
-                                      lval,
                                       non_constant_p, overflow_p);
       break;
 
@@ -7113,7 +7112,6 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, 
tree t,
     case TRUTH_ORIF_EXPR:
       r = cxx_eval_logical_expression (ctx, t, boolean_true_node,
                                       boolean_false_node,
-                                      lval,
                                       non_constant_p, overflow_p);
       break;
 

base-commit: 93b65ed9706e2ceb4be7b28c9ff9be759e68a614
-- 
2.35.1

Reply via email to