Hi all,
can someone please tell me what’s wrong with the following code and how to fix it? It works with recent versions of ifort:
PROGRAM test_pass_unl
TYPE new
INTEGER, DIMENSION(:), ALLOCATABLE :: i
END TYPE
CLASS(*), ALLOCATABLE :: test
TYPE(new) :: n
ALLOCATE(n%i(5))
ALLOCATE(test,SOURCE=n)
SELECT TYPE(test)
TYPE IS (new)
CALL pass(test)
CLASS DEFAULT
PRINT*,'whooops!'
END SELECT
CONTAINS
SUBROUTINE pass(arg)
TYPE(new) :: arg
PRINT*,arg%i
END SUBROUTINE pass
END PROGRAM test_pass_unl
Here’s what I get when I try to compile:
$ pgfortran -V
pgfortran 11.1-0 64-bit target on x86-64 Linux -tp penryn
Copyright 1989-2000, The Portland Group, Inc. All Rights Reserved.
Copyright 2000-2011, STMicroelectronics, Inc. All Rights Reserved.
$
$
$ pgfortran -O3 -Bstatic test.f90 -o test
PGF90-S-0188-Argument number 1 to pass: type mismatch (test.f90: 13)
0 inform, 0 warnings, 1 severes, 0 fatal for test_pass_unl
Many thanks in advance.