]> gcc.gnu.org Git - gcc.git/commit
[Ada] Detection of illegal constituent assignments
authorHristian Kirtchev <kirtchev@adacore.com>
Thu, 11 Jan 2018 08:55:52 +0000 (08:55 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Thu, 11 Jan 2018 08:55:52 +0000 (08:55 +0000)
commit5efc1c00c88b7758d628ce8e2d1e6d54d5996216
treeed4741920d80ba135a51595bea4de21ce8080c44
parent4dfba737a48b4a3934eabb93a406facfd148afd5
[Ada] Detection of illegal constituent assignments

This patch modifies the analysis of assignment statements to detect an illegal
attempt to alter the value of single protected type Part_Of constituent when
inside a protected function.

2018-01-11  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

* sem_ch5.adb (Analyze_Assignment): Assignments to variables that act
as Part_Of consituents of single protected types are illegal when they
take place inside a protected function.
(Diagnose_Non_Variable_Lhs): Use Within_Function to check for an
enclosing function.
(Is_Protected_Part_Of_Constituent): New routine.
(Within_Function): New routine.

gcc/testsuite/

* gnat.dg/protected_func.adb, gnat.dg/protected_func.ads: New testcase.

From-SVN: r256520
gcc/ada/ChangeLog
gcc/ada/sem_ch5.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/protected_func.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/protected_func.ads [new file with mode: 0644]
This page took 0.101282 seconds and 5 git commands to generate.