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]

Re: [Patch, Fortran] PR 52024 - fix .mod issue with type-bound operator check


Tobias Burnus wrote:
Unfortunately, it turns out that the check does not handle inheritance well. At least I would expect that the attached test case is valid (and it compiles with NAG 5.1), but it is rejected with GCC 4.6 and 4.7.

Actually, I withdraw that comment. I now believe that gt_cmp and gt_cmp_int are ambiguous in


+ generic :: operator(.gt.) => gt_cmp
+ generic :: operator(.gt.) => gt_cmp_int

as an actual argument of declared type class(sort_t) is type compatible to a dummy of declared type class(sort_int_t).

The fix is to do the following. One keeps for the first type:

+    generic :: operator(.gt.) =>  gt_cmp
+    procedure :: gt_cmp
+    end type sort_t


And then later just has:


+    procedure :: gt_cmp =>  gt_cmp_int
+  end type


That is: One overrides the specific function, one does not add a new generic interface.


Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]