(j3.2006) Constraint C835: SELECT TYPE selector must be a named variable
Damian Rouson
sourcery
Thu Nov 6 15:54:08 EST 2014
Could someone tell me the motivation for the following constraint on ?select type? selectors in the Fortran 2008 standard?
C835 (R847) If selector is not a named variable, associate-name => shall appear.
I?m guessing this constraint explains the Cray compiler error message below (gfortran gives essentially the same error message). What?s the motivation for disallowing the second ?select type? statement below?
On a possibly related note, Note 6.1 states that ?P%AGE? is a ?variable?. How does a ?variable? differ from a ?named variable?? I can find the phrase ?named variable? in only a few places in the standard, but I can?t find a definition of it.
Damian
p01923 at swan:~> cat selecttype.f90
program main
implicit none
type object
end type
type foo
class(object), allocatable :: stuff
end type
type(foo) :: bar
select type(barstuff=>bar%stuff ) ! This compiles cleanly
end select
select type(bar%stuff ) ! This gives an error
end select
end
p01923 at swan:~> ftn selecttype.f90
select type(bar%stuff ) ! This gives an error
^
ftn-1875 crayftn: ERROR MAIN, File = selecttype.f90, Line = 13, Column = 15
The SELECT TYPE selector must be a named variable or an associate-name must appear.
Cray Fortran : Version 8.3.4 (u83056f83186i83169p83291a83009e83011z83291)
Cray Fortran : (x8318r83015w83011t8311b83037)
Cray Fortran : Sun Nov 02, 2014 10:08:52
Cray Fortran : Compile time: 0.0040 seconds
Cray Fortran : 16 source lines
Cray Fortran : 1 errors, 0 warnings, 0 other messages, 0 ansi
Cray Fortran : "explain ftn-message number" gives more information about each message.
More information about the J3
mailing list