- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Consider the following simple code involving a parameterized derived type (PDT):
program p implicit none type :: t(k) integer, kind :: k = 0 end type !type(t) :: foo = t(k=0)() ! <-- This works type(t) :: foo = t() ! <-- This does not print *, "foo%k = ", foo%k stop end program p
Compiling with Intel(R) Visual Fortran Compiler 17.0.0.109 [Intel(R) 64]... p.f90 p.f90(11): error #6197: An assignment of different structure types is invalid. [FOO] ifort: error #10298: problem during post processing of parallel object compilation compilation aborted for p.f90 (code 1)
It would appear Intel Fortran development team's interpretation of the standard is type parameters must be declared with the type in a structure constructor - is this correct? It does not seem right, but I could be wrong yet I couldn't find any supporting statement(s) or constraint(s) in the standard document (WD 1539-1 J3/10-007r1 for Fortran 2008, 24 Nov. 2010) in favor of Intel Fortran implementation. All I find in relation to structure constructors points back to "derived-type-spec" which has the following: see the highlighted line 31 (i.e., point 4.5.9.3)
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think this is our error. As I see it, the problem with t() is trying to decide if the () is the type-param-spec-list or the component-spec-list. I think that if () is seen then that is always a component-spec-list, since the type-param-spec-list is not allowed to be empty. I'll send this on to the developers. DPD200415364
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page