This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Cryptic error message for procedure bound to a type
- From: Armelius Cameron <armeliusc at gmail dot com>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: Fortran List <fortran at gcc dot gnu dot org>
- Date: Wed, 8 Sep 2010 11:56:23 -0400
- Subject: Re: Cryptic error message for procedure bound to a type
- References: <201009081026.18980.armeliusc@gmail.com> <4C87A2BB.3000300@net-b.de>
On Wednesday, September 08, 2010 10:50:35 am Tobias Burnus wrote:
> Hi Armelius,
>
> On 09/08/2010 04:26 PM, Armelius Cameron wrote:
> > I got the following error message that I don't understand:
> >
> > -----------
> >
> > procedure, private, pass ::&
> >
> > 1
> >
> > Error: Non-polymorphic passed-object dummy argument of 'initialize_mv'
> > at (1)
>
> The compiler is trying to tell you that your program violates the
> following constraint:
>
> C456 The passed-object dummy argument shall be a scalar, nonpointer,
> nonallocatable dummy data object with the same declared type as the type
> being dened; all of its length type parameters shall be assumed; it
> shall be polymorphic (4.3.1.3) if and only if the type being dened is
> extensible (4.5.7). It shall not have the VALUE attribute.
> I would argue that your type "UnitValueForm" is extensible and that thus
> the compiler is correct to reject:
I see; I didn't think about that before. I just thought the type of the PASSed
dummy argument should match the type.
More question, the last phrase of the standard: "...if and only if the type
being defined is extensible (4.5.7) ", what type is not extensible then ? (It's
an honest question, not trying to be sarcastic :) ). Does all PASS-ed argument
of type-bound procedure need be "CLASS(..)" then ?
What is the different in the implementation of the procedure if I use "CLASS()"
instead of TYPE() ?
BTW, the book "Fortran 2003 Handbook" by Adams, Brainerd, et all gives an
example similar to my code on page 89 (using TYPE() instead of CLASS() for the
dummy argument); and the code from the book is also rejected (with the same
message) by gfortran. I guess the book example is wrong then ?
Thanks.
AC