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

Unexpected "error #6773: An equals sign (=) is invalid in this context" with use of structure constructor in a named constant

$
0
0

The following simple code gives unexpected "error #6773: An equals sign (=) is invalid in this context" with the use of structure constructor in a named constant, but the error doesn't occur in an assignment statement.

module m

   implicit none

   integer, parameter :: N = 1

   integer, parameter :: C(N) = [ 0 ]

   type :: t
      integer :: x(N)
   end type t

contains

   subroutine foo()

      type(t) :: t1
      type(t), parameter :: t2 = t( x = C )

      t1 = t( x = C )

      return

   end subroutine foo

end module m

I'm using the initial release of compiler 16 (v16.0.0.110):

Compiling with Intel(R) Visual Fortran Compiler 16.0 [Intel(R) 64]...
m.f90
m.f90(18): error #6773: An equals sign (=) is invalid in this context.   [X]
compilation aborted for m.f90 (code 1)

I can't find anything in the standard suggesting anything invalid with the above shown structure constructor in a named constant as opposed to the assignment, but may be I'm missing something.  I appreciate feedback on this error.


Viewing all articles
Browse latest Browse all 5691

Trending Articles



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