The RM reference in the error message for a use of 'access whose prefix is
not aliased mentioned the wrong paragraph in the RM.
Compiling proc.adb must yield:
proc.adb:6:03:
object in prefixed call to "Q" must be aliased (RM 4.1.3 (13 1/2))
--
package P is
type T is tagged null record;
procedure Q (Param : access T) is null;
end P;
---
with P;
procedure Proc is
My_P : P.T;
begin
My_P.Q;
end Proc;
Tested on x86_64-pc-linux-gnu, committed on trunk
2014-10-31 Ed Schonberg <[email protected]>
* sem_attr.adb (Analyze_Access_Attribute): Do not emit error
message if reference does not come from source, as in the case
for the controlling argument of a dispatching call. Error is
diagnosed when call is resolved.
* sem_ch4.adb (Complete_Object_Operation); Fix incorrect RM
reference in error message.
* sem_res.adb (Check_Prefixed_Call): ditto.
Index: sem_res.adb
===================================================================
--- sem_res.adb (revision 216960)
+++ sem_res.adb (working copy)
@@ -3261,7 +3261,7 @@
if not Is_Aliased_View (Act) then
Error_Msg_NE
("object in prefixed call to& must be aliased "
- & "(RM-2005 4.3.1 (13))",
+ & "(RM 4.1.3 (13 1/2))",
Prefix (Act), Nam);
end if;
Index: sem_attr.adb
===================================================================
--- sem_attr.adb (revision 216925)
+++ sem_attr.adb (working copy)
@@ -1041,12 +1041,17 @@
if not Is_Aliased_View (P)
and then not In_Instance
and then not In_Inlined_Body
+ and then Comes_From_Source (N)
then
-- Here we have a non-aliased view. This is illegal unless we
-- have the case of Unrestricted_Access, where for now we allow
-- this (we will reject later if expected type is access to an
-- unconstrained array with a thin pointer).
+ -- No need for an error message on a generated access reference
+ -- for the controlling argument in a dispatching call: error will
+ -- be reported when resolving the call.
+
if Aname /= Name_Unrestricted_Access then
Error_Attr_P ("prefix of % attribute must be aliased");
Check_No_Implicit_Aliasing (P);
Index: sem_ch4.adb
===================================================================
--- sem_ch4.adb (revision 216956)
+++ sem_ch4.adb (working copy)
@@ -7585,7 +7585,7 @@
if not Is_Aliased_View (Obj) then
Error_Msg_NE
("object in prefixed call to & must be aliased "
- & "(RM-2005 4.3.1 (13))", Prefix (First_Actual), Subprog);
+ & "(RM 4.1.3 (13 1/2))", Prefix (First_Actual), Subprog);
end if;
Analyze (First_Actual);