This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ada/38331] New: Illegal program not detected, "=" not predefined for class-wide types, ARM 4.5.2(6) and AI05-71
- From: "ludovic at ludovic-brenta dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Nov 2008 15:12:41 -0000
- Subject: [Bug ada/38331] New: Illegal program not detected, "=" not predefined for class-wide types, ARM 4.5.2(6) and AI05-71
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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 "=".
--
Summary: Illegal program not detected, "=" not predefined for
class-wide types, ARM 4.5.2(6) and AI05-71
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38331