{
ada_var_value_operation *vvo
= dynamic_cast<ada_var_value_operation *> (m_val.get ());
- if (vvo != nullptr)
+ if (vvo == nullptr)
error (_("Invalid record component association."));
name = vvo->get_symbol ()->natural_name ();
+ /* In this scenario, the user wrote (name => expr), but
+ write_name_assoc found some fully-qualified name and
+ substituted it. This happens because, at parse time, the
+ meaning of the expression isn't known; but here we know
+ that just the base name was supplied and it refers to the
+ name of a field. */
+ name = ada_unqualified_name (name);
}
index = 0;
--- /dev/null
+# Copyright 2023 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+load_lib "ada.exp"
+
+require allow_ada_tests
+
+standard_ada_testfile main
+
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable debug] != ""} {
+ return -1
+}
+
+clean_restart ${testfile}
+
+set bp_location [gdb_get_line_number "BREAK" ${testdir}/main.adb]
+runto "main.adb:$bp_location"
+
+gdb_test_multiple "print pck.value := (Left => 3, Center => 7, Pck.Right => 2)" \
+ "assign to value" {
+ -wrap -re " = \\(3, 7, 2\\)" {
+ pass $gdb_test_name
+ }
+ -wrap -re " = \\(3, 2, 2\\)" {
+ setup_kfail "aggregate expression bug" *-*-*
+ fail $gdb_test_name
+ }
+ }
+
+gdb_test "print pck.svalue := (center => 99)" \
+ [string_to_regexp " = (center => 99)"]
--- /dev/null
+-- Copyright 2023 Free Software Foundation, Inc.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+With Pck;
+with Xtra;
+
+procedure Main is
+begin
+ Xtra.Do_Nothing (Pck.Value); -- BREAK
+end Main;
--- /dev/null
+-- Copyright 2023 Free Software Foundation, Inc.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+package Pck is
+ type Posn is (Left, Center, Right);
+ type My_Array is array (Posn) of Integer;
+
+ Value : My_Array := (Left => 1, Center => 2, Right => 3);
+
+ type Structured is
+ record
+ Center : Integer;
+ end record;
+
+ SValue : Structured := (Center => 23);
+
+end Pck;
--- /dev/null
+-- Copyright 2023 Free Software Foundation, Inc.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+package body Xtra is
+ procedure Do_Nothing (Buffer: in out Pck.My_Array) is
+ begin
+ null;
+ end Do_Nothing;
+end Xtra;
--- /dev/null
+-- Copyright 2023 Free Software Foundation, Inc.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+with Pck;
+
+package Xtra is
+ -- Confounding.
+ Center : Pck.Posn := Pck.Right;
+ Right : Pck.Posn := Pck.Left;
+
+ procedure Do_Nothing (Buffer: in out Pck.My_Array);
+end Xtra;