Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28988 Discussions

Type parameter inquiry and intrinsic types

IanH
Honored Contributor III
492 Views

"A type parameter inquiry is used to inquire about a type parameter of a data object.  It applies to both intrinsic and derived types."

IMPLICIT NONE
CHARACTER(*), PARAMETER :: const = 'Hello'
PRINT *, const%LEN
PRINT *, 'This is weird syntax'(:)%LEN
END

 

>ifort /check:all /warn:all /standard-semantics "2014-09-24 kind-param-inquiry.f90"
Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.0.108 Build 201407
26
Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.

2014-09-24 kind-param-inquiry.f90(4): error #5082: Syntax error, found '%' when expecting one of: * ) :: , <END-OF-STATEMENT> ; . (/ + - : ] /) ' ** / // > .LT. < ...
PRINT *, 'This is weird syntax'(:)%LEN
----------------------------------^
2014-09-24 kind-param-inquiry.f90(3): error #6460: This is not a field name that is defined in the encompassing structure.   [LEN]
PRINT *, const%LEN
---------------^
2014-09-24 kind-param-inquiry.f90(3): error #6158: The structure-name is invalid or is missing.   [CONST]
PRINT *, const%LEN
---------^
2014-09-24 kind-param-inquiry.f90(4): error #6404: This name does not have a type, and must have an explicit type.   [LEN]
PRINT *, 'This is weird syntax'(:)%LEN
-----------------------------------^
2014-09-24 kind-param-inquiry.f90(4): error #6355: This binary operation is invalid for this data type.   ['This is weird syntax']
PRINT *, 'This is weird syntax'(:)%LEN
---------^
2014-09-24 kind-param-inquiry.f90(4): error #6549: An arithmetic or LOGICAL type is required in this context.
PRINT *, 'This is weird syntax'(:)%LEN
----------------------------------^
compilation aborted for 2014-09-24 kind-param-inquiry.f90 (code 1)

 

0 Kudos
3 Replies
IanH
Honored Contributor III
492 Views

(Obviously LEN isn't a kind param for CHARACTER, I just like naming my files to confuse myself.)
 

0 Kudos
Steven_L_Intel1
Employee
492 Views

Thanks. I know that we had some issues with type parameter inquiries - we'll take a look at this.

0 Kudos
Steven_L_Intel1
Employee
492 Views

Escalated as DPD200361370. I agree that syntax is "weird", but it is legal. It seems that ifort doesn't like the inquiry functions on PARAMETER constants or literals.

0 Kudos
Reply