This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Tested on i686-linux, committed on HEAD
The following program must be rejected.
gcc -c -gnatws ren.adb
ren.adb:14:13: not mode conformant with declaration at line 4
ren.adb:14:13: mode of "C" does not match
procedure Ren is
task type Tsk is
entry E1;
entry E2 (B : Boolean);
end;
BOOL : BOOLEAN := False;
OBJ1 : TSK;
OBJ2 : TSK;
procedure RP1 renames OBJ1.E1;
procedure RP2 (C : Boolean) renames OBJ2.E2; -- OK
procedure RP3 (C : out Boolean) -- Error: C vs B modes
renames OBJ2.E2;
task body tsk is
begin
null;
end;
begin
null;
end;
Secondly, renaming an operator as a different operator is confusing, and is
often the indication of a typo. The following program:
--
package pack is
type A_Type is tagged null record;
function ">" (This, That : A_Type) return Boolean;
function "<" (Left, Right : Pack.A_Type) return Boolean
renames Pack.">";
end;
--
when compiled with -gnatc, now reports:
--
pack.ads:4:13: warning: ">" is being renamed as a different operator
2005-09-01 Ed Schonberg <schonberg@adacore.com>
* sem_ch8.adb (Analyze_Renamed_Entry): For a renaming_as_declaration,
verify that the procedure and the entry are mode conformant.
(Analyze_Subprogram_Renaming): Emit a warning if an operator is renamed
as a different operator, which is often a cut-and-paste error.
Attachment:
difs.38
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |