Quantcast
Channel: Intel® Software - Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2746

Derived type constructor for extended types does not initialize all fields

$
0
0

Dear Fortran,

I have some derived types, types extended from a root (astract) type.

I define (scalar) variables using their constructors.

When the type is "simple" types (e.g. Point_2D : real :: x, y) it is Ok

But, when the type is more complicated (e.g. Circle : Point_2D and real :: radius)

  the field radius is not intialized.

More strange (see output file) if the type is like ( Rectangle : Point_2D , real: h,w) the

 h-field is initialized with the value of w-field and, therefore, w_fild not initialized

See details and program in attached files.

(Of course, if the fields are defined field by field it is Ok but more tedious to do)


Viewing all articles
Browse latest Browse all 2746

Trending Articles