Bug 38331 - Illegal program not detected, "=" not predefined for class-wide types, ARM 4.5.2(6) and AI05-71
Summary: Illegal program not detected, "=" not predefined for class-wide types, ARM 4....
Status: RESOLVED DUPLICATE of bug 16094
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2008-11-30 15:12 UTC by Ludovic Brenta
Modified: 2008-11-30 15:16 UTC (History)
1 user (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 2008-11-30 15:12:41 UTC
generic
   type Item (<>) is private;
   with function "=" (L, R : Item) return Boolean is <>;
package pak1 is
end pak1;


with pak1;
package pak2 is
   type T is tagged null record;
   package new_pak1a is new pak1 (Item => T'Class);    --OK by AI05-71
   package new_pak1b is new pak1 (Item => T'Class, "=" => "=");       --ERROR:
   package new_pak1c is new pak1 (Item => T'Class, "=" => pak2."=");  --ERROR:
end pak2;

The compiler accepts this program; it should reject new_pak1b and new_pak1c because function "=" (L, R : T'Class) does not exist.  The equality operator is defined only for "specific type T that is not limited, and not an anonymous access type" (ARM 4.5.2(6)); class-wide types are not "specific" per ARM 3.9(3).

The reason why new_pak1a is legal is because of the special rule in AI05-71 which only applies when _not_ specifying an actual for the generic formal "=".
Comment 1 Ludovic Brenta 2008-11-30 15:16:05 UTC

*** This bug has been marked as a duplicate of 16094 ***