https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105243
--- Comment #8 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Tue, May 17, 2022 at 07:56:18PM +0000, anlauf at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105243 > > --- Comment #7 from anlauf at gcc dot gnu.org --- > (In reply to Steve Kargl from comment #6) > > > I quoted the F2018 standard constraint. > > > > > > C708 An entity declared with the CLASS keyword shall be a dummy > > > argument or have the ALLOCATABLE or POINTER attribute. > > > > > > class(t), parameter :: y > > > > > > would seem to be missing all of the three listed attributes. > > You're right here. > > > I'll also add > > > > 7.3.2.3 CLASS type specifier > > > > The CLASS type specifier is used to declare polymorphic entities. > > A polymorphic entity is a data entity that is able to be of differing > > dynamic types during program execution. > > > > Does is make sense to given a named constant the polymorphic property? > > Well, I could imagine named constants that do not have a type (e.g. when > using CLASS(*)), as well as named constants that refer to an extensible > type. The F2023 draft even has CLASSOF. Where will this finally lead... > > I think I should ask the Intel people why their compiler accepts > > program p > type t > integer :: i = 1 > end type t > type(t), parameter :: a = t() ! Legal > class(t), parameter :: b = t() ! Likely not > class(*), parameter :: c = t() ! ... > class(*), parameter :: d = 1 ! ... > end > None of these are dummy arguments. None of these have the ALLOCATABLE attribute. None of these have the POINTER attribute. These all violate C708. For 4.2 Conformance, 2 A processor conforms to this document if: (3) it contains the capability to detect and report the use within a submitted program unit of a form or relationship that is not permitted by the numbered syntax rules or constraints, including the deleted features described in Annex B; Furthermore, the PARAMETER attribute conflicts with a dummy argument, ALLOCATABLE attribute, and POINTER attribute. At least, gfortran believes there is a conflict. subroutine foo0(x) class(*), parameter :: x end subroutine foo0 subroutine foo1() type t integer :: i = 1 end type t class(t), parameter, allocatable :: a end subroutine foo1 subroutine foo2() type t integer :: i = 1 end type t class(t), parameter, pointer :: a end subroutine foo2 % gfortran11 -c a.f90 a.f90:2:26: 2 | class(*), parameter :: x | 1 Error: PARAMETER attribute conflicts with DUMMY attribute at (1) a.f90:9:22: 9 | class(t), parameter, allocatable :: a | 1 Error: PARAMETER attribute conflicts with ALLOCATABLE attribute at (1) a.f90:16:31: 16 | class(t), parameter, pointer :: a | 1 Error: PARAMETER attribute conflicts with POINTER attribute at (1)