aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2008-08-04 11:05:40 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2008-08-04 11:05:40 +0200
commit0f5177ad7276bc202d09711f923257a17030a4d5 (patch)
tree5df59538b207c3a78af7504435e58bf91ba8af8c /gcc
parentba622ca2e157b81d29f21969bd0bea8bd3781189 (diff)
downloadgcc-0f5177ad7276bc202d09711f923257a17030a4d5.zip
gcc-0f5177ad7276bc202d09711f923257a17030a4d5.tar.gz
gcc-0f5177ad7276bc202d09711f923257a17030a4d5.tar.bz2
sem_ch3.adb (Access_Definition): Create an itype reference for an anonymous access return type of a regular...
2008-08-04 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Access_Definition): Create an itype reference for an anonymous access return type of a regular function that is not a compilation unit. From-SVN: r138583
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_ch3.adb20
1 files changed, 16 insertions, 4 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index f67d34d..c95f5da 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -935,13 +935,25 @@ package body Sem_Ch3 is
Build_Itype_Reference (Anon_Type, Parent (Parent (Related_Nod)));
-- Similarly, if the access definition is the return result of a
- -- protected function, create an itype reference for it because it
- -- will be used within the function body.
+ -- function, create an itype reference for it because it
+ -- will be used within the function body. For a regular function that
+ -- is not a compilation unit, insert reference after the declaration.
+ -- For a protected operation, insert it after the enclosing protected
+ -- type declaration. In either case, do not create a reference for a
+ -- type obtained through a limited_with clause, because this would
+ -- introduce semantic dependencies.
elsif Nkind (Related_Nod) = N_Function_Specification
- and then Ekind (Current_Scope) = E_Protected_Type
+ and then not From_With_Type (Anon_Type)
then
- Build_Itype_Reference (Anon_Type, Parent (Current_Scope));
+ if Ekind (Current_Scope) = E_Protected_Type then
+ Build_Itype_Reference (Anon_Type, Parent (Current_Scope));
+
+ elsif Is_List_Member (Parent (Related_Nod))
+ and then Nkind (Parent (N)) /= N_Parameter_Specification
+ then
+ Build_Itype_Reference (Anon_Type, Parent (Related_Nod));
+ end if;
-- Finally, create an itype reference for an object declaration of
-- an anonymous access type. This is strictly necessary only for