[Ada] Missing error on illegal access to discriminant
authorJavier Miranda <miranda@adacore.com>
Thu, 24 May 2018 13:06:28 +0000 (13:06 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Thu, 24 May 2018 13:06:28 +0000 (13:06 +0000)
commit24e959661f42da6c5c65de96a7c9d88082c3ffd8
tree575ba6090c393eb39e9941dc6668e309bb1fcd35
parent5a5925ee30a8f8b43d045726aa7b2a82c6a6af61
[Ada] Missing error on illegal access to discriminant

The compiler does not report an error on the illegal access to a renamed
discriminant when the actual object is a parameter of a subprogram.

2018-05-24  Javier Miranda  <miranda@adacore.com>

gcc/ada/

* sem_ch3.adb (Is_Visible_Component): For untagged types add missing
check for renamed discriminants.
* sem_ch4.adb (Analyze_Overloaded_Selected_Component,
Analyze_Selected_Component, Check_Misspelled_Selector): For calls to
Is_Visible_Component pass the associated selector node to allow
checking renamed discriminants on untagged types.

gcc/testsuite/

* gnat.dg/discr52.adb: New testcase.

From-SVN: r260664
gcc/ada/ChangeLog
gcc/ada/sem_ch3.adb
gcc/ada/sem_ch4.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/discr52.adb [new file with mode: 0644]