From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BEFF1393C84C; Mon, 7 Dec 2020 09:23:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BEFF1393C84C From: "mscfd at gmx dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/97612] Structure constructor of type with nested allocatable array components fails to compile Date: Mon, 07 Dec 2020 09:23:11 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 10.1.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: mscfd at gmx dot net X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2020 09:23:11 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97612 --- Comment #2 from martin --- I do not see why it should not be valid. t() is a structure constructor acting much like a function with (in this ca= se) one optional argument. And as an allocatable component has default initialisation, no value needs to be provided, to be valid constructor. Just to be sure I checked Metcalf (2011). Section 15.3 "Structure construct= ors" and 20.1.4 "Structure constructors" contain an interesting piece of informa= tion I did not know about: F03 forgot to allow that for allocatable components a value can be omitted. This was permitted in F08. So it looks like the provi= ded code example is not valid F03 but valid F08. In fact, null() can be provided as default value. Then the code compiles: type(t) :: a =3D t(null())=