https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102745

            Bug ID: 102745
           Summary: CLASS → TYPE check fails after RESHAPE
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

Found when working on PR102689

Expected:
* 'CLASS(t)' in the first error message
* an error for passing CLASS(t) to TYPE(t2) in the call with RESHAPE.


implicit none (type, external)
type t
end type t
type, extends(t) :: t2
  integer :: i
end type t2

class(t), allocatable :: A(:), B(:,:,:)

allocate (t2 :: A(100), B(10,10,1))

call bar(A)  ! Rejected (with slightly odd message: Error: Type mismatch in
argument ‘x’ at (1); passed CLASS(__class_MAIN___T_1_0a) to TYPE(t2)
call bar(reshape(B, [size(B)]))  ! Wrongly accepted

contains

subroutine bar(x)
  type(t2), intent(in) :: x(:)
end
end

Reply via email to