This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: [Patch, Fortran, OOP] PR 57306: ICE on valid with class pointer initialization


>> Looking at gfc_class_initializer, I have the impression that it does not
>> handle initialization of unlimited polymorphic variables/components. I don't
>> know whether initialization is permitted, but my feeling is that the
>> following should work:
>>
>> type t
>>   class(*), pointer :: x
>> end type t
>> type(t), target :: y
>> integer,target :: z
>> type(t) :: x = t(y)
>> type(t) :: x = t(z)
>> class(*), pointer :: a => y
>>
>> And I have the feeling that it is not correctly treated - but I might be
>> wrong. (Note to the example above: I believe "t(y)" is a valid structure
>> constructor, which is not yet supported. But again, I might be wrong about
>> either.)
>
> Your example yields (with and without the current patch):
>
> tobias2.f90:7.17:
>
> type(t) :: x = t(y)
>                  1
> Error: Can't convert TYPE(t) to CLASS(*) at (1)
> tobias2.f90:8.17:
>
> type(t) :: x = t(z)
>                  1
> Error: Can't convert INTEGER(4) to CLASS(*) at (1)

In fact this problem is more similar to PR 49213 than the one under
discussion here. I have added the above test case to PR 49213 as
comment 12.

Cheers,
Janus


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