- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If an object with a character array component is of a type that extends another type, then attempts to substring the character component result in strange errors.
MODULE m
IMPLICIT NONE
TYPE :: Parent
END TYPE Parent
TYPE, EXTENDS(Parent) :: Extension
CHARACTER(10) :: component(5)
END TYPE Extension
CONTAINS
SUBROUTINE s(arg)
CLASS(Extension), INTENT(IN) :: arg
PRINT *, arg%component(2)(1:3)
END SUBROUTINE s
END MODULE m
>ifort /c /check:all /warn:all /standard-semantics "2014-09-02 character-component.f90"
Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.0.108 Build 20140726
Copyright (C) 1985-2014 Intel Corporation. All rights reserved.
2014-09-02 character-component.f90(11): error #6460: This is not a field name that is defined in the encompassing struct
ure. [COMPONENT]
PRINT *, arg%component(2)(1:3)
-----------------^
2014-09-02 character-component.f90(11): error #6514: A substring must be of type CHARACTER. [COMPONENT]
PRINT *, arg%component(2)(1:3)
-----------------^
2014-09-02 character-component.f90(11): error #6158: The structure-name is invalid or is missing. [ARG]
PRINT *, arg%component(2)(1:3)
-------------^
compilation aborted for 2014-09-02 character-component.f90 (code 1)
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Weird. Escalated as DPD200360549.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page