Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

Structure constructor with pointer component silliness

$
0
0

The compiler complains that the component spec in the structure constructor is not of the same type and kind as the component.  But it is... isn't it?

 

MODULE m
  IMPLICIT NONE

  TYPE, PUBLIC :: NodeRef
    TYPE(Node), POINTER :: item => NULL()
  END TYPE NodeRef

  TYPE, PUBLIC :: Node
    TYPE(NodeRef), ALLOCATABLE :: upstream(:)
  END TYPE Node
CONTAINS
  SUBROUTINE s(self)
    TYPE(Node), INTENT(INOUT), TARGET :: self
    self%upstream = [NodeRef(self)]
  END SUBROUTINE s
END MODULE m

 

 

>ifort /c /check:all /warn:all /standard-semantics "2015-09-24 nodes.f90"
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0 Build 20150815
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.

2015-09-24 nodes.f90(17): error #6795: The target must be of the same type and kind type parameters as the pointer.   [SELF]
    self%upstream = [NodeRef(self)]
-----------------------------^
compilation aborted for 2015-09-24 nodes.f90 (code 1)

 


Viewing all articles
Browse latest Browse all 3270

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>