From 1ac7452264fee536b0f62610e8dbe9f9e253a6f8 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 15 Mar 2021 06:23:12 -0600 Subject: Fix Ada assignment resolution The expression rewrite missed an Ada resolution case. GDB previously knew how to disambiguate the right hand side of an assignment, but now it does not. This patch fixes the problem and adds the missing test case. gdb/ChangeLog 2021-03-15 Tom Tromey * ada-exp.y (exp1): Handle resolution of the right hand side of an assignment. gdb/testsuite/ChangeLog 2021-03-15 Tom Tromey * gdb.ada/enums_overload/enums_overload_main.adb: New file. * gdb.ada/enums_overload/enums_overload.ads: New file. * gdb.ada/enums_overload/enums_overload.adb: New file. * gdb.ada/enums_overload.exp: New file. --- gdb/ada-exp.y | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'gdb/ada-exp.y') diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y index 222fec5..4300907 100644 --- a/gdb/ada-exp.y +++ b/gdb/ada-exp.y @@ -413,7 +413,17 @@ exp1 : exp | exp1 ';' exp { ada_wrap2 (); } | primary ASSIGN exp /* Extension for convenience */ - { ada_wrap2 (); } + { + operation_up rhs = pstate->pop (); + operation_up lhs = ada_pop (); + value *lhs_val + = lhs->evaluate (nullptr, pstate->expout.get (), + EVAL_AVOID_SIDE_EFFECTS); + rhs = resolve (std::move (rhs), true, + value_type (lhs_val)); + pstate->push_new + (std::move (lhs), std::move (rhs)); + } ; /* Expressions, not including the sequencing operator. */ -- cgit v1.1