- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you try to use a structure constructor to construct a type that extends from some other type, and you have an array section argument, you get an error like the following:
test_section_constructor.F90(18): error #6593: The number of expressions in a structure constructor differs from the number of components of the derived type [FOO]
b = foo(a2(:,1)) ! Spurious error
----^
compilation aborted for test_section_constructor.F90 (code 1)
This happens even when you only have one component and one argument to the structure constructor.
Here's the full test case:
program test_section_constructor implicit none type, abstract :: foo_base end type foo_base type, extends(foo_base) :: foo integer, allocatable :: a(:) end type foo type(foo) :: b integer :: a1(2) = 0 integer :: a2(2,2) = 0 b = foo(a1) ! OK b = foo(a2(:,1)) ! Spurious error end program test_section_constructor
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I reproduced this error and forwarded to Development (under internal tracking id below) and will update the post regarding a fix.
(Internal tracking id: DPD200255191)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've found that this also occurs with certain intrinsics as the argument, e.g. "spread".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, thank you for the new info. I added a note to the Developers regarding that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It seems that this was addressed in 15.0.0

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page