[Ada] Fix bug in inherited user-defined-literal aspects for tagged types
authorSteve Baird <baird@adacore.com>
Mon, 2 Aug 2021 23:18:08 +0000 (16:18 -0700)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 1 Oct 2021 06:13:36 +0000 (06:13 +0000)
commitaa4648eef474d7827b9ccf948ad4de128783e171
tree73385a605f8ed74946f949e50943ca214a414422
parenta6fe12b0a9a375e655945ff385810661d8bb494c
[Ada] Fix bug in inherited user-defined-literal aspects for tagged types

gcc/ada/

* sem_res.adb (Resolve): Two separate fixes. In the case where
Find_Aspect for a literal aspect returns the aspect for a
different (ancestor) type, call Corresponding_Primitive_Op to
get the right callee. In the case where a downward tagged type
conversion appears to be needed, generate a null extension
aggregate instead, as per Ada RM 3.4(27).
* sem_util.ads, sem_util.adb: Add new Corresponding_Primitive_Op
function. It maps a primitive op of a tagged type and a
descendant type of that tagged type to the corresponding
primitive op of the descendant type. The body of this function
was written by Javier Miranda.
gcc/ada/sem_res.adb
gcc/ada/sem_util.adb
gcc/ada/sem_util.ads