This Fortran 2003 feature is nice for direct use in structure constructors, actual arguments and the like. But my simple mind ed testing of it fails :(
PROGRAM dont_you_forget_about_me IMPLICIT NONE TYPE :: t INTEGER :: alive_and_kicking END TYPE t TYPE(t), ALLOCATABLE :: array(:) array = [t ::] PRINT *, SIZE(array) END PROGRAM dont_you_forget_about_me
>ifort /c "2016-08-13 arrayconstructors.f90" Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 17.0 Beta Build 20160517 Copyright (C) 1985-2016 Intel Corporation. All rights reserved. ifort: NOTE: The Beta evaluation period for this product ends on 7-oct-2016 UTC. 2016-08-13 arrayconstructors.f90(9): error #5082: Syntax error, found '::' when expecting one of: ] , (/ : array = [t ::] -------------^ 2016-08-13 arrayconstructors.f90(9): error #6478: A type-name must not be used as a variable. [T] array = [t ::] -----------^ compilation aborted for 2016-08-13 arrayconstructors.f90 (code 1)
Previously discussed here.