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

Can a BLOCK construct be within an ASSOCIATE construct and recognize the associations?

$
0
0

The following code with a BLOCK construct (Fortran 2008) within an ASSOCIATE construct fails to compile when the associate-name is used inside the block.  Is this only to be expected per the standard?  I couldn't find anything in the standard that says this is not allowed.

program p

   implicit none

   character(len=:), allocatable :: foo

   foo = "Hello World!"

   asc: associate ( s => foo )

      print *, " foo says ", s

      blk: block

         print *, " foo says ", s

      end block blk

   end associate asc

   stop

end program p
1>Compiling with Intel(R) Visual Fortran Compiler XE 15.0.2.179 [Intel(R) 64]...
1>p.f90
1>C:\..\p.f90(15): error #6404: This name does not have a type, and must have an explicit type.   [S]
1>compilation aborted for C:\..\p.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>