mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 14:06:39 +00:00

Fortran allows an earlier-declared KIND type parameter of a parameterized derived type to be used in the constant expression defining the integer kind of a later type parameter. TYPE :: T(K,L) INTEGER, KIND :: K INTEGER(K), LEN :: L ... END TYPE Differential Revision: https://reviews.llvm.org/D159044https://reviews.llvm.org/D159044
16 lines
376 B
Fortran
16 lines
376 B
Fortran
! RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s
|
|
program p
|
|
type t(k,n)
|
|
integer, kind :: k
|
|
integer(k), len :: n
|
|
!CHECK: warning: INTEGER(1) addition overflowed
|
|
integer :: c = n + 1_1
|
|
end type
|
|
!CHECK: in the context: instantiation of parameterized derived type 't(k=1_4,n=127_1)'
|
|
print *, t(1,127)()
|
|
end
|
|
|
|
!CHECK: PRINT *, t(k=1_4,n=127_1)(c=-128_4)
|
|
|
|
|