Silverfrost Forums

Welcome to our forums

Incorrect use of derived type

27 Aug 2013 1:46 #12922

The following program attempts to increment an integer component of a derived type, but in line 14 incorrectly refers to u%j%i instead of u%t%i.

MODULE m
  TYPE t1
    INTEGER :: i=0
  END TYPE t1
  TYPE t2
    INTEGER :: j=0
    TYPE(t1) :: t
  END TYPE t2
END MODULE m
!
PROGRAM p
  USE m
  TYPE(t2) :: u
  PRINT *, u%j%i+1
END PROGRAM p

The compiler, appropriately, generates an error message, but seems to imply that u is integer. Is it possible for the compiler to indicate that u%j is INTEGER(KIND=3) rather than u?

27 Aug 2013 6:05 #12924

I have logged this. It could be that the compiler is looking at J rather than U.

Chances are the error report is generally correct and this is an exception so these things are not necessarily easy to fix.

27 Aug 2013 7:52 #12925

Hello,

This is the same BUG I refer to in the post below. See message of 31 July for the simplest example.

https://forums.silverfrost.com/Forum/Topic/2180

I am still hoping that this can be fixed at some point, because at the momement derived types with default initialization are not usable with the compiler.

27 Aug 2013 10:34 #12927

This is simply an unnecessary (and incorrectly phrased) error report which I have now suppressed.

It does not bear any relation to other bugs which we aim to fix in due course.

Please login to reply.