aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/decl.cc
diff options
context:
space:
mode:
authorGary Dismukes <dismukes@adacore.com>2023-11-15 23:57:47 +0000
committerMarc Poulhiès <poulhies@adacore.com>2023-11-28 10:35:48 +0100
commit1a2f4e332c0bca0b6665921c38be9c9f1c04e0b4 (patch)
tree80ecb5bdbd4d77f9733b34cde9c822b994414098 /gcc/ada/gcc-interface/decl.cc
parentecdcb83025143f00e95ce9f86b9e80c770116c46 (diff)
downloadgcc-1a2f4e332c0bca0b6665921c38be9c9f1c04e0b4.zip
gcc-1a2f4e332c0bca0b6665921c38be9c9f1c04e0b4.tar.gz
gcc-1a2f4e332c0bca0b6665921c38be9c9f1c04e0b4.tar.bz2
ada: Errors on instance of Multiway_Trees with discriminated type
The compiler may report various type conflicts on an instantiation of the generic package Ada.Containers.Multiway_Trees with an actual for Element_Type that is a nonprivate actual type with discriminants that has a discriminant-dependent component of a private type (such as a Bounded_Vector type). The type errors occur on an aggregate of the implementation type Tree_Node_Type within the body of Multiway_Trees, where the aggregate has a box-defaulted association for the Element component. (Such type errors could of course arise in other cases of generic instantiations that follow a similar type model.) In the case where the discriminant-dependent component type has a default-initialization procedure (init proc), the compiler was handling box associations for such components by expanding the topmost box association into subaggregates that themselves have box associations, and didn't properly account for discriminant-dependent subcomponents of private types. This could be fixed internally in Propagate_Discriminants, but it seems that the entire machinery for dealing with such subcomponent associations is unnecessary, and the topmost component association can be handled directly as a default-initialized box association. gcc/ada/ * sem_aggr.adb (Add_Discriminant_Values): Remove this procedure. (Propagate_Discriminants): Remove this procedure. (Resolve_Record_Aggregate): Remove code (the Capture_Discriminants block statement) related to propagating discriminants and generating initializations for subcomponents of a discriminant-dependent box-defaulted subcomponent of a nonprivate record type with discriminants, and handle all top-level components that have a non-null base init proc directly, by calling Add_Association with "Is_Box_Present => True". Also, combine that elsif clause with the immediately preceding elsif clause, since they now both contain the same statement (calls to Add_Association with the same actuals).
Diffstat (limited to 'gcc/ada/gcc-interface/decl.cc')
0 files changed, 0 insertions, 0 deletions