diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-12-19 16:24:34 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-12-19 16:24:34 +0000 |
commit | 5e96b145b389d660e51c5f4f42122f96085e7c9d (patch) | |
tree | 7bd8f604f676059fb88629a80dabde0b96b3e2f8 /gcc/ada/sem_ch6.adb | |
parent | 0cd59c118d696092aaead1d09db59591ce085e3b (diff) | |
download | gcc-5e96b145b389d660e51c5f4f42122f96085e7c9d.tar.gz |
2007-12-19 Ed Schonberg <schonberg@adacore.com>
Gary Dismukes <dismukes@adacore.com>
PR ada/15803, ada/15805
* sem_ch6.adb, sem_ch3.adb (Constrain_Access): In Ada2005, diagnose
illegal access subtypes when there is a constrained partial view.
(Check_For_Premature_Usage): New procedure inside
Access_Subprogram_Declaration for checking that an access-to-subprogram
type doesn't reference its own name within any formal parameters or
result type (including within nested anonymous access types).
(Access_Subprogram_Declaration): Add call to Check_For_Premature_Usage.
(Sem_Ch3.Analyze_Object_Declaration, Sem_ch6.Process_Formals): if the
context is an access_to_variable, the expression cannot be an
access_to_constant.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131079 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_ch6.adb')
-rw-r--r-- | gcc/ada/sem_ch6.adb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 5f513690c2e..9aaa37f9fb4 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -6996,18 +6996,17 @@ package body Sem_Ch6 is Analyze_Per_Use_Expression (Default, Formal_Type); - -- Check that an access to constant is not used with an - -- access type. + -- An access to constant cannot be the default for + -- an access parameter that is an access to variable. if Ekind (Formal_Type) = E_Anonymous_Access_Type and then not Is_Access_Constant (Formal_Type) and then Is_Access_Type (Etype (Default)) and then Is_Access_Constant (Etype (Default)) then - Error_Msg_NE ("parameter of type& cannot be initialized " & - "with an access-to-constant expression", - Default, - Formal_Type); + Error_Msg_N + ("formal that is access to variable cannot be initialized " & + "with an access-to-constant expression", Default); end if; -- Check that the designated type of an access parameter's default |