Array constructors

Array constructors

Zero sized array constructors for derived types used to work, didn't they?  They syntax for them appears to be in the compiler docs.

PROGRAM WhereDidZeroSizedArrayConstructorsGo
  IMPLICIT NONE
  
  TYPE :: my_type
  END TYPE my_type
  TYPE(my_type), ALLOCATABLE :: array(:)
  
  array = [ my_type :: ]
  PRINT *, SIZE(array)
END PROGRAM WhereDidZeroSizedArrayConstructorsGo

>ifort /check:all /warn:all /standard-semantics ArrayConstructors.f90
Intel(R) Visual Fortran Compiler XE for applications running on IA-32, Version 13.0.1.119 Build 20121008
Copyright (C) 1985-2012 Intel Corporation.  All rights reserved.
ArrayConstructors.f90(8): error #5082: Syntax error, found '::' when expecting one of: , (/ : ]
  array = [ my_type :: ]
--------------------^
ArrayConstructors.f90(8): error #6478: A type-name must not be used as a variable.   [MY_TYPE]
  array = [ my_type :: ]
------------^
compilation aborted for ArrayConstructors.f90 (code 1)

Or am I imagining things?  I would have sworn that they were in active use in our code base, but now I can't find any examples.

Yours in deluded confusion,

IanH

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

We don't yet support this with derived types - it's already on our list. We do support it with intrinsic types, for example:

[integer::]

Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today