This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: Dynamic dispatch of class typebound procedures ~ methods


Janus,

On Mon, Sep 28, 2009 at 11:43 AM, Janus Weil <janus@gcc.gnu.org> wrote:
> Hi Paul,
>
>> Nonetheless, I have stared at symbol.c(gfc_type_compatible) and the
>> standard and have come to the conclusion that the former is not quite
>> correct. ?At very least, it does not do the right thing, I believe,
>> when both ts1 and ts2 are CLASSes (It winds up comparing the class
>> containers, rather than the declared types. ?More importantly, here,
>> what should happen when the actual argument is a class, whose value is
>> an extension of the declared type of a class formal argument?
>
> well, I think although this case is not treated explicitly, it should
> still work correctly. If both are classes, it is checked whether the
> class container of ts2 is an extension of the type of ts1 (which is
> the case if the type of ts2 is an extension of the type of ts1, since
> the class container is an extension of the the type of ts2.
>
> So I believe it should be correct, or do I miss something?
>
>
>> It does
>> not treat this case at all (- because formal and actual are the wrong
>> way round in the call from gfc_compare_types?).
>
> in compare_parameter you find
>
> gfc_compare_types (&formal->ts, &actual->ts)
>
> while gfc_compare_types itself calls
>
> gfc_type_compatible (ts1, ts2)
>
> so I think the ordering of the formal vs. actual argument should be ok
> (of course gfc_type_compatible must be asymmetic in its arguments.

I happen to know that the generic matching works if you interchange them:-)

Cheers

Paul


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