(j3.2006) Mixing a type-bound generic with an "interface" genericprocedure
Malcolm Cohen
malcolm
Tue Jan 17 03:08:12 EST 2012
I did not see a reply for this, so ...
>I am pretty sure that the following is invalid and that "12.4.3.4.5
>Restrictions on generic declarations" somehow must apply. However, I cannot
>nail it.
First sentence of 12.4.3.4.5 applies, so yes it is invalid ... assuming the
interfaces of your procedures are in fact ambiguous. See also 16.3.4p4 which
establishes the scope of the generic type-bound procedure.
In any case, the standard does not establish an interpretation (because the
assignment is ambiguous) so the code is by definition not standard-conforming,
see 1.5p1 sentence 1. That sentence is the "emergency brake" as it were, so if
that were the only reason the code was invalid we should fix the standard to
make it explicitly invalid; that does not seem the case here though.
-----Original Message-----
From: Tobias Burnus
Date: ?? 23?12?16? 23:23
To: fortran standards email list for J3
Subject: (j3.2006) Mixing a type-bound generic with an "interface"
genericprocedure
Dear all,
I am pretty sure that the following is invalid and that "12.4.3.4.5
Restrictions on generic declarations" somehow must apply. However, I
cannot nail it.
In the example below one has both an "interface assignment(=)" and a
type-bound "generic :: assignment(=)".
type, abstract :: sort_t
contains
generic :: assignment(=) => assign
procedure(assign), deferred :: assign
...
interface assignment(=)
procedure assign
end interface
...
class(sort_t), intent(inout) :: a(:),tmp
a(1) = tmp
I have two compilers which accept the code: one uses the external
procedure "assign", the other uses the overridden type-bound procedure
"assign". (I don't have a compiler which diagnoses the two "assign" as
error.)
Tobias
_______________________________________________
J3 mailing list
J3 at j3-fortran.org
http://j3-fortran.org/mailman/listinfo/j3
________________________________________________________________________
This e-mail has been scanned for all viruses by Star.
________________________________________________________________________
--
................................Malcolm Cohen, Nihon NAG, Tokyo.
More information about the J3
mailing list