-
- Downloads
c++: improve failed constexpr assume diagnostic
I noticed that we were printing "the comparison reduces to (x == 42)" when we should be able to give the value of x. Fixed by doing the same evaluation in diagnose_failing_condition that we already do in find_failing_clause. gcc/cp/ChangeLog: * constexpr.cc (fold_operand): New function. (find_failing_clause_r): Add const. (find_failing_clause): Add const. (diagnose_failing_condition): Add ctx parameter. (cxx_eval_internal_function): Pass it. * semantics.cc (diagnose_failing_condition): Move to constexpr.cc. * cp-tree.h: Adjust. gcc/testsuite/ChangeLog: * g++.dg/cpp23/attr-assume2.C: Expect constant values.
Showing
- gcc/cp/constexpr.cc 50 additions, 13 deletionsgcc/cp/constexpr.cc
- gcc/cp/cp-tree.h 3 additions, 2 deletionsgcc/cp/cp-tree.h
- gcc/cp/semantics.cc 0 additions, 27 deletionsgcc/cp/semantics.cc
- gcc/testsuite/g++.dg/cpp23/attr-assume2.C 2 additions, 2 deletionsgcc/testsuite/g++.dg/cpp23/attr-assume2.C
Loading
Please register or sign in to comment