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: Cryptic error message for procedure bound to a type


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 dened; all of its length type parameters shall be assumed; it
> shall be polymorphic (4.3.1.3) if and only if the type being dened 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


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