+2021-03-15 Tom Tromey <tromey@adacore.com>
+
+ * ada-exp.y (simple_exp): Always push a result for unary '+'.
+
2021-03-15 Tom Tromey <tromey@adacore.com>
* ada-lang.c (ada_unop_ind_operation::evaluate): Call
operation_up arg = ada_pop ();
operation_up empty;
- /* We only need to handle the overloading
- case here, not anything else. */
+ /* If an overloaded operator was found, use
+ it. Otherwise, unary + has no effect and
+ the argument can be pushed instead. */
operation_up call = maybe_overload (UNOP_PLUS, arg,
empty);
if (call != nullptr)
- pstate->push (std::move (call));
+ arg = std::move (call);
+ pstate->push (std::move (arg));
}
;
+2021-03-15 Tom Tromey <tromey@adacore.com>
+
+ * gdb.ada/fixed_points.exp: Add tests of unary + and -.
+
2021-03-15 Tom Tromey <tromey@adacore.com>
* gdb.ada/varsize_limit.exp: Add new test.
gdb_test "print fp2_var - 0" \
" = -0.01"
+ gdb_test "print + fp2_var" \
+ " = -0.01"
+ gdb_test "print - fp2_var" \
+ " = 0.01"
+
set fp4 "= 2e-07"
gdb_test "print fp4_var" $fp4
gdb_test "print fp4_var * 1" $fp4