Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

parameterised derived type default kind parameters

$
0
0

Parameterised derived types with kind parameters which have default values set to parameters are not working as I expect in Intel Visual Fortran Compiler XE 15.0.2.179. Is this a bug or are my expectations wrong?

The following code shows the issue:

module imp_module

  implicit none
  private

  integer, parameter :: n = 5

  type, public :: dt(k)
     integer, kind :: k = n
     integer, dimension(k) :: x
  end type dt

end module imp_module

program imp_prog

  use imp_module

  type(dt) :: x

  print *,x

end program imp_prog

Compiling the code gives:

Deleting intermediate files and output files for project 'imp', configuration 'Debug|Win32'.
Compiling with Intel(R) Visual Fortran Compiler XE 15.0.2.179 [IA-32]...
ifort /nologo /debug:full /Od /warn:interfaces /module:"Debug\\" /object:"Debug\\" /Fd"Debug\vc120.pdb" /traceback /check:bounds /check:stack /libs:dll /threads /dbglibs /c /Qvc12 /Qlocation,link,"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\\bin""C:\Users\Nicholas\Documents\imp_bug\imp_module.f90"
ifort /nologo /debug:full /Od /warn:interfaces /module:"Debug\\" /object:"Debug\\" /Fd"Debug\vc120.pdb" /traceback /check:bounds /check:stack /libs:dll /threads /dbglibs /c /Qvc12 /Qlocation,link,"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\\bin""C:\Users\Nicholas\Documents\imp_bug\imp_prog.f90"
C:\Users\Nicholas\Documents\imp_bug\imp_prog.f90(5): error #6683: A kind type parameter must be a compile-time constant.   [N]
  type(dt) :: x
^
compilation aborted for C:\Users\Nicholas\Documents\imp_bug\imp_prog.f90 (code 1)


imp - 2 error(s), 0 warning(s)

 


Viewing all articles
Browse latest Browse all 5691

Latest Images

Trending Articles



Latest Images

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