This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Tested on i686-linux, committed on trunk
Two related fixes involving aggregate components initialized with a box.
--
In Ada 2005 default associations for aggregate components generate calls
to the initialization procedure for the type (often a limited type). When
compiling in semantics-only mode, initialization procedures are not
generated, but the box default is still legal if it corresponds to a
component of the type.
gnat.dg/aggr2.adb must compile quietly.
The treatment of Ada 2005 default associations for aggregate components
did not check that an association with a box actually named a real
component. This patch fixes the omission.
The following program must produce:
--
pkg1.ads:11:50: "three" is not a component of type "rec" defined at line 4
pkg1.ads:12:50: "three" is not a component of type "rec" defined at line 4
--
package pkg1 is
type root is tagged null record;
--
type rec is new root with
record
one, two : integer;
end record;
--
Obj : rec := ( root with one => <>, two => <>); -- OK
--
Obj1 : rec := ( root with one => 1, two => 2, three => -1); -- ERROR
Obj2 : rec := ( root with one => 1, two => 2, three => <>); -- ERROR
end;
2007-04-06 Ed Schonberg <schonberg@adacore.com>
Bob Duff <duff@adacore.com>
* sem_aggr.adb (Resolve_Record_Aggregate): In semantics-only mode treat
an association with a box as providing a value even though the
initialization procedure for the type is not available.
(Resolve_Record_Aggregate): Check that a choice of an association with a
box corresponds to a component of the type.
(Resolve_Record_Aggregate): Split Is_Abstract flag into
Is_Abstract_Subprogram and Is_Abstract_Type.
* exp_tss.adb (Base_Init_Proc): Use Is_Type instead of Type_Kind for
assert.
* inline.adb (Add_Inlined_Body): Split Is_Abstract flag into
Is_Abstract_Subprogram and Is_Abstract_Type. Make sure these are
called only when appropriate.
Attachment:
difs
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |