diff options
author | Samuel Tardieu <sam@gcc.gnu.org> | 2008-04-15 11:02:58 +0000 |
---|---|---|
committer | Samuel Tardieu <sam@gcc.gnu.org> | 2008-04-15 11:02:58 +0000 |
commit | 8abe457acb2207a1d3b3d5e020c532780276dcdd (patch) | |
tree | ed5095bf2553e7adbc5c4b819ce0e8345de6f839 /gcc/ada/sem_ch12.adb | |
parent | 29f4754ff005a8b53f2f4341093bf1e800aad4ce (diff) | |
download | gcc-8abe457acb2207a1d3b3d5e020c532780276dcdd.tar.gz |
[multiple changes]
2008-04-15 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
PR ada/16086
* sem_ch12.adb (Analyze_Formal_Subprogram): The default can be any
protected operation that matches the signature, not only an entry, a
regular subprogram or a literal.
2008-04-15 Samuel Tardieu <sam@rfc1149.net>
gcc/testsuite/
PR ada/16086
* gnat.dg/prot_def.adb: New.
From-SVN: r134312
Diffstat (limited to 'gcc/ada/sem_ch12.adb')
-rw-r--r-- | gcc/ada/sem_ch12.adb | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index e7755c4f534..c44f3929d50 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -2361,30 +2361,34 @@ package body Sem_Ch12 is -- Default name may be overloaded, in which case the interpretation -- with the correct profile must be selected, as for a renaming. + -- If the definition is an indexed component, it must denote a + -- member of an entry family. If it is a selected component, it + -- can be a protected operation. if Etype (Def) = Any_Type then return; elsif Nkind (Def) = N_Selected_Component then - Subp := Entity (Selector_Name (Def)); - - if Ekind (Subp) /= E_Entry then + if not Is_Overloadable (Entity (Selector_Name (Def))) then Error_Msg_N ("expect valid subprogram name as default", Def); - return; end if; elsif Nkind (Def) = N_Indexed_Component then - if Nkind (Prefix (Def)) /= N_Selected_Component then - Error_Msg_N ("expect valid subprogram name as default", Def); - return; - - else - Subp := Entity (Selector_Name (Prefix (Def))); + if Is_Entity_Name (Prefix (Def)) then + if Ekind (Entity (Prefix (Def))) /= E_Entry_Family then + Error_Msg_N ("expect valid subprogram name as default", Def); + end if; - if Ekind (Subp) /= E_Entry_Family then + elsif Nkind (Prefix (Def)) = N_Selected_Component then + if Ekind (Entity (Selector_Name (Prefix (Def)))) + /= E_Entry_Family + then Error_Msg_N ("expect valid subprogram name as default", Def); - return; end if; + + else + Error_Msg_N ("expect valid subprogram name as default", Def); + return; end if; elsif Nkind (Def) = N_Character_Literal then @@ -2410,6 +2414,9 @@ package body Sem_Ch12 is end if; else + + -- Several interpretations. Disambiguate as for a renaming. + declare I : Interp_Index; I1 : Interp_Index := 0; @@ -9778,6 +9785,8 @@ package body Sem_Ch12 is -- interface then the generic formal is not unless declared -- explicitly so. If not declared limited, the actual cannot be -- limited (see AI05-0087). + -- Disable check for now, limited interfaces implemented by + -- protected types are common, Need to update tests ??? if Is_Limited_Type (Act_T) and then not Is_Limited_Type (A_Gen_T) |