Bug 31416 - Illegal program not detected, RM 7.3(13), 4.9.1(1)
Summary: Illegal program not detected, RM 7.3(13), 4.9.1(1)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 4.1.1
: P3 minor
Target Milestone: 4.9.0
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2007-03-31 23:06 UTC by Ludovic Brenta
Modified: 2015-12-05 11:35 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ludovic Brenta 2007-03-31 23:06:23 UTC
In the program below, the full declaration of T2 (in the private part
of the package) is illegal because it conflicts with the public
declaration.  The public declaration defines the discriminant, d1, to
have the value 3 whereas the private declaration specifies the value
to be 4.

GNAT fails to diagnose this error.

-- error not detected
package pak1 is
   -- RM 7.3(13), 4.9.1(1)
   -- check that discriminants statically match
   type T1(d1: integer) is tagged null record;
   type T2 is new T1 (3) with private;
private
   subtype T3 is T1 (4);
   type T2 is new T3 with null record;  -- Error: 3 vs 4
end pak1;

To reproduce:

gnatmake pak1.ads

Error message expected:
pak1.ads:9:8: full view of type "T2" conflicts with public declaration at line 6
Comment 1 Ludovic Brenta 2007-03-31 23:28:13 UTC
This is Debian Bug#416975.
Comment 2 Nicolas Boulenguez 2011-08-31 13:19:46 UTC
found 4.6.1
Comment 3 Nicolas Boulenguez 2014-02-27 18:58:58 UTC
Fixed in 4.9-20140218
Comment 4 Eric Botcazou 2015-12-05 11:35:54 UTC
.