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

Reply via email to