diff options
author | Tom Tromey <tromey@adacore.com> | 2021-03-15 06:23:12 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2021-03-15 06:23:12 -0600 |
commit | 1ac7452264fee536b0f62610e8dbe9f9e253a6f8 (patch) | |
tree | c300360bc3df87f909e9c5148e7bf41999406a52 /gdb/ada-exp.y | |
parent | 207582c0758738447d2df8f778aeebf126c73b31 (diff) | |
download | gdb-1ac7452264fee536b0f62610e8dbe9f9e253a6f8.zip gdb-1ac7452264fee536b0f62610e8dbe9f9e253a6f8.tar.gz gdb-1ac7452264fee536b0f62610e8dbe9f9e253a6f8.tar.bz2 |
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 <tromey@adacore.com>
* ada-exp.y (exp1): Handle resolution of the right hand side of an
assignment.
gdb/testsuite/ChangeLog
2021-03-15 Tom Tromey <tromey@adacore.com>
* 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.
Diffstat (limited to 'gdb/ada-exp.y')
-rw-r--r-- | gdb/ada-exp.y | 12 |
1 files changed, 11 insertions, 1 deletions
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<comma_operation> (); } | primary ASSIGN exp /* Extension for convenience */ - { ada_wrap2<ada_assign_operation> (); } + { + 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<ada_assign_operation> + (std::move (lhs), std::move (rhs)); + } ; /* Expressions, not including the sequencing operator. */ |