aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/fe.h
diff options
context:
space:
mode:
authorGary Dismukes <dismukes@adacore.com>2024-03-26 01:01:57 +0000
committerMarc Poulhiès <poulhies@adacore.com>2024-05-20 09:47:05 +0200
commitd1e3aae37894079ebd0be2a6baccce5a89a251c3 (patch)
treef9b42b3595b353f1fc1cb261b6604b6fb1a59bef /gcc/ada/fe.h
parentb226e5605a6e1833da85590b10a5acf0b16d00d8 (diff)
downloadgcc-d1e3aae37894079ebd0be2a6baccce5a89a251c3.zip
gcc-d1e3aae37894079ebd0be2a6baccce5a89a251c3.tar.gz
gcc-d1e3aae37894079ebd0be2a6baccce5a89a251c3.tar.bz2
ada: Error on instantiation of generic containing legal container aggregate
When a container aggregate for a predefined container type (such as a Vector type) that has an iterated component association occurs within a generic unit and that generic is instantiated, the compiler reports a spurious error message "iterated component association can only appear in an array aggregate" and the compilation aborts (because Unrecoverable_Error is raised unconditionally after that error). The problem is that as part of the instantiation process, for aggregates whose type has a partial view, in Copy_Generic_Node the compiler switches the visibility so that the full view of the type is available, and for a type whose full view is a record type this leads to incorrectly trying to process the aggregate as a record aggregate in Resolve_Aggregate (making a call to Resolve_Record_Aggregate). Rather than trying to address this by changing what Copy_Generic_Node does, this can be fixed by reordering and adjusting the code in Resolve_Aggregate, so that we first test whether we need to resolve as a record aggregate (if the aggregate is not homogeneous), followed by testing whether the type has an Aggregate aspect and calling Resolve_Container_Aggregate. As a bonus, we also remove the subsequent complex condition and redundant code for handling null container aggregates. gcc/ada/ * sem_aggr.adb (Resolve_Aggregate): Move condition and call for Resolve_Record_Aggregate in front of code related to calling Resolve_Container_Aggregate (and add test that the aggregate is not homogeneous), and remove special-case testing and call to Resolve_Container_Aggregate for empty aggregates.
Diffstat (limited to 'gcc/ada/fe.h')
0 files changed, 0 insertions, 0 deletions