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 modifies the implementation of AI05-0071 to allow several special cases of equality to appear in instantiations where a formal type has unknown discriminants, a defaulted equality and the actual type is class-wide. ------------ -- Source -- ------------ -- equals_gen.ads generic type Formal_Typ (<>) is private; with function "=" (L : Formal_Typ; R : Formal_Typ) return Boolean is <>; package Equals_Gen is end Equals_Gen; -- equals_types.ads package Equals_Types is type AT_1 is abstract tagged null record; function "=" (L : AT_1; R : AT_1) return Boolean; function "=" (L : AT_1'Class; R : AT_1'Class) return Boolean; type AT_2 is abstract tagged null record; function "=" (L : AT_2; R : AT_2) return Boolean; type AT_3 is abstract tagged null record; function "=" (L : AT_3'Class; R : AT_3'Class) return Boolean; type AT_4 is abstract tagged null record; type AT_5 is interface; function "=" (L : AT_5; R : AT_5) return Boolean is abstract; function "=" (L : AT_5'Class; R : AT_5'Class) return Boolean; type AT_6 is interface; function "=" (L : AT_6; R : AT_6) return Boolean is abstract; type AT_7 is interface; function "=" (L : AT_7'Class; R : AT_7'Class) return Boolean; type AT_8 is interface; end Equals_Types; -- equals_instances.ads with Equals_Gen; with Equals_Types; use Equals_Types; package Equals_Instances is package Inst_1 is new Equals_Gen (AT_1'Class); -- ERROR package Inst_2 is new Equals_Gen (AT_2'Class); -- ok package Inst_3 is new Equals_Gen (AT_3'Class); -- ok package Inst_4 is new Equals_Gen (AT_4'Class); -- ok package Inst_5 is new Equals_Gen (AT_5'Class); -- ERROR package Inst_6 is new Equals_Gen (AT_6'Class); -- ok package Inst_7 is new Equals_Gen (AT_7'Class); -- ok package Inst_8 is new Equals_Gen (AT_8'Class); -- ok end Equals_Instances; ---------------------------- -- Compilation and output -- ---------------------------- $ gcc -c equals_instances.ads equals_instances.ads:5:04: instantiation error at equals_gen.ads:3 equals_instances.ads:5:04: ambiguous actual for generic subprogram "=" equals_instances.ads:5:04: possible interpretation: "=" defined at equals_types.ads:3 equals_instances.ads:5:04: possible interpretation: "=" defined at equals_types.ads:4 equals_instances.ads:9:04: instantiation error at equals_gen.ads:3 equals_instances.ads:9:04: ambiguous actual for generic subprogram "=" equals_instances.ads:9:04: possible interpretation: "=" defined at equals_types.ads:15 equals_instances.ads:9:04: possible interpretation: "=" defined at equals_types.ads:16 Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-04 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch8.adb (Build_Class_Wide_Wrapper): Handle various special cases related to equality. Remove the special processing for dispatching abstract subprograms as it is not needed. (Interpretation_Error): Add a specialized error message for predefined operators. (Is_Intrinsic_Equality): New routine. (Is_Suitable_Candidate): New routine.
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] |