This is correct and a feature of Fortran 2003.
Another related feature of Fortran 2003 is for allocatable arrays, where you could say:
integer, allocatable, dimension(:) :: a
a = [3,4,5]
and a would get automatically allocated to the proper shape, deallocating any previous allocation. In Intel Fortran, this behavior is NOT the default and requires an option /assume:realloc_lhs. However, the use you described with the derived type components does not require the option.
Steve,
While obviously convenient - is this also not a bit dangerous?
What happens if you erroneously do something like
a=[3,4,5]
...
a=[3,4,5,10]
where the use of a 4-element array is a bug (lets say due to bug)
Then my understanding is that F-2003 reallocates array a "behind your back", which would make it harder to catch this bug. Conversely F-95 would generate an access error and you'd have a pretty clear indication of a bug.
I suppose this comes down to safety vs convenience, I am not really criticizing, just contemplating ;-)