Hi All,

I have to confess that I had never spotted the two PDT examples in the
F2018 standard. To my horror, they both fail.

The second example involves finalizers of PDTs and is already caught by
104650. I am onto that one as well :-)

A PDT typespec in a function declaration such as;

  CONTAINS
    TYPE(t(single)) FUNCTION real_to_t1(x)
    REAL(single) x
    real_to_t1%value = x
  END FUNCTION

causes gfc_use_derived to emit, "Derived type ‘pdtt_4’ at (1) is being used
before it is defined", whereas this;

CONTAINS
  FUNCTION real_to_t1(x)
    TYPE(t(single)) real_to_t1
    REAL(single) x
    real_to_t1%value = x
  END FUNCTION

compiled and ran successfully. The attached patch fixes this problem and is
explained by the ChangeLog and the comment in the patch.

Regtest OK on FC43/x86_64. OK for mainline?

Paul

Reply via email to