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] | |
This patch fixes the problem of not catching a missing return in
a generic function (the error was caught at instantiation time, but
it is an illegality in the template).
with apa; use apa;
procedure mainmr is
function fool2 is new fool;
begin
null;
end;
package apa is
generic
function fool return integer;
end apa;
package body apa is
function fool return integer is
begin
null;
end fool;
end apa;
If we compile mainmr.adb, we now get the message on the template:
Compiling: mainmr.adb
1. with apa; use apa;
2. procedure mainmr is
3. function fool2 is new fool;
4. begin
5. null;
6. end;
==============Error messages for source file: apa.adb
2. function fool return integer is
|
>>> missing "return" statement in function body
6 lines: 1 error
Prior to this patch, the error was issued on the instantiation,
and not issued at all if the generic was never instantiated.
Tested on x86_64-pc-linux-gnu, committed on trunk
2010-06-23 Robert Dewar <dewar@adacore.com>
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Properly handle
checking returns in generic case.
(Check_Missing_Return): New procedure.
Attachment:
difs
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |