This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] PR 52024 - fix .mod issue with type-bound operator check
- From: Tobias Burnus <burnus at net-b dot de>
- To: gcc patches <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Tue, 31 Jan 2012 23:41:58 +0100
- Subject: Re: [Patch, Fortran] PR 52024 - fix .mod issue with type-bound operator check
- References: <4F2869D0.8070201@net-b.de>
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