I have some difficulties to point from a Superclass to a Subclass Object. tElement is the Superclass and tBeam is the Subclass.
TYPE(tBeam), ALLOCATABLE, TARGET :: beams(:) CLASS(tElement), POINTER :: element CLASS(tElement), POINTER :: elements(:) ALLOCATE(beams(1:10))
It works for a single Object...:
ALLOCATE(Element, SOURCE = beams(1), STAT = ierror)
... but for an array it seems to work because ierror is 0, but in Visual Studio he shows me "undefined pointer/array"
ALLOCATE(Elements, SOURCE = beams, STAT = ierror)
is this a Visual Studio Bug or am I doing something wrong?
MODULE mElement IMPLICIT NONE PRIVATE PUBLIC :: tElement TYPE :: tElement INTEGER(4) :: element_property = 1234 END TYPE tElement END MODULE mElement MODULE mBeam USE mElement IMPLICIT NONE TYPE, EXTENDS(tElement) :: tBeam INTEGER(4) :: beam_property = 5678 END TYPE tBeam END MODULE mBeam PROGRAM TEST USE mBeam USE mElement IMPLICIT NONE TYPE(tBeam), ALLOCATABLE, TARGET :: beams(:) CLASS(tElement), POINTER :: element CLASS(tElement), POINTER :: elements(:) INTEGER(4) :: ierror INTEGER(4) :: element_property, beam_property ALLOCATE(beams(1:10)) ALLOCATE(Element, SOURCE = beams(1), STAT = ierror) IF (ierror .EQ. 0) & & element_property = Element%element_property ALLOCATE(Elements, SOURCE = beams, STAT = ierror) IF (ierror .EQ. 0) & & element_property = Elements(3)%element_property END PROGRAM TEST
Edit.: I am using
Microsoft Visual Studio Professional 2015 Version 14.0.25431.01 Update 3
Intel(R) Visual Fortran Compiler 126.96.36.199 [IA-32]
it would help to post your exact compiler version (PSXE 2018 update 1 e.g.) and your Visual Studio version (2015 update 3 e.g.) as well to solve your issue. From my gut feeling I would say it is just an issue of Intel's VS extension for the debugger. I've observed similar with derived type components at other places where hoover over or watch list insist on 'undefined pointer/ array' but it is defined. A simple print shows, that the compiler is working fine in that cases. Unfortunately, the Visual Studio integration is sometimes not complete.
It would help to improve the integration by filing this issue on OSC also.
Best regards, Johannes
See this thread:
What you're noticing is likely a limitation of Intel Fortran integration with Visual Studio in that the object shows up as "undefined pointer/array" in the debugger watch windows, etc. Code likely executes consistently with the instructions you have provided.
This doesn't seem familiar.
Please file the report; that way it can be triaged by the actual people making (or having made?) the fix to determine if it's a duplicate or not.
Really, we do appreciate it!