* [Ada] Missing error in function expressions
@ 2017-09-08 13:31 Arnaud Charlet
0 siblings, 0 replies; only message in thread
From: Arnaud Charlet @ 2017-09-08 13:31 UTC (permalink / raw)
To: gcc-patches; +Cc: Javier Miranda
[-- Attachment #1: Type: text/plain, Size: 959 bytes --]
The compiler skips reporting errors located in function expressions.
After this patch the error is reported in the following sources:
package Base is
type Base_Type is tagged record
V : Integer;
end record;
function Func_1 (B : Base_Type) return Integer is (B.V);
end;
with Base;
package DB is
type DB_Type is new Base.Base_Type with record
Y : Integer;
end record;
overriding
function Func_1 (B : DB_Type) return Integer;
private
function Func_1 (B : DB_Type) return Integer is
(Base.Func_1 (Base_Type (B)) / 8 * 4); -- Error
end;
Command: gcc -c db.ads
Output:
db.ads:13:20: "Base_Type" is not visible
db.ads:13:20: non-visible declaration at base.ads:2
Tested on x86_64-pc-linux-gnu, committed on trunk
2017-09-08 Javier Miranda <miranda@adacore.com>
* sem_ch8.adb (Find_Direct_Name.Undefined): Do
not add entries into the undefined reference table when we are
compiling with errors ignored.
[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 740 bytes --]
Index: sem_ch8.adb
===================================================================
--- sem_ch8.adb (revision 251892)
+++ sem_ch8.adb (working copy)
@@ -5328,9 +5328,10 @@
-- Make entry in undefined references table unless the full errors
-- switch is set, in which case by refraining from generating the
-- table entry, we guarantee that we get an error message for every
- -- undefined reference.
+ -- undefined reference. The entry is not added if we are ignoring
+ -- errors.
- if not All_Errors_Mode then
+ if not All_Errors_Mode and then Ignore_Errors_Enable = 0 then
Urefs.Append (
(Node => N,
Err => Emsg,
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-09-08 13:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-08 13:31 [Ada] Missing error in function expressions Arnaud Charlet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).