diff options
author | Steve Baird <baird@adacore.com> | 2019-09-18 08:33:02 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-09-18 08:33:02 +0000 |
commit | c8324fe7b12851c16c867f16ce248c95d2dbae7d (patch) | |
tree | 437e451f15dcf936fa47c5012fc19fecec221f33 /gcc/dwarf2out.c | |
parent | 6bc08721d027d10a2d9ea98c753a8bf0b4493e91 (diff) | |
download | gcc-c8324fe7b12851c16c867f16ce248c95d2dbae7d.zip gcc-c8324fe7b12851c16c867f16ce248c95d2dbae7d.tar.gz gcc-c8324fe7b12851c16c867f16ce248c95d2dbae7d.tar.bz2 |
[Ada] Implement AI12-0086's rules for discriminants in aggregates
In Ada2012, a discriminant value that governs an active variant part in
an aggregate had to be static. AI12-0086 relaxes this restriction - if
the subtype of the discriminant value is a static subtype all of whose
values select the same variant, then that is good enough.
2019-09-18 Steve Baird <baird@adacore.com>
gcc/ada/
* sem_util.ads (Interval_Lists): A new visible package. This
package is visible because it is also intended for eventual use
in Sem_Eval.Subtypes_Statically_Compatible when that function is
someday upgraded to handle static predicates correctly. This
new package doesn't really need to be visible for now, but it
still seems like a good idea.
* sem_util.adb (Gather_Components): Implement AI12-0086 via the
following strategy. The existing code knows how to take a static
discriminant value and identify the corresponding variant; in
the newly-permitted case of a non-static value of a static
subtype, we arbitrarily select a value of the subtype and find
the corresponding variant using the existing code. Subsequently,
we check that every other value of the discriminant's subtype
corresponds to the same variant; this is done using the newly
introduced Interval_Lists package.
(Interval_Lists): Provide a body for the new package.
gcc/testsuite/
* gnat.dg/ai12_0086_example.adb: New testcase.
From-SVN: r275857
Diffstat (limited to 'gcc/dwarf2out.c')
0 files changed, 0 insertions, 0 deletions