public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: "Joseph S. Myers" <jsm28@cam.ac.uk> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: c/10450: gcc-3.2.2 produces error on initializing a structure with a constant expression Date: Tue, 22 Apr 2003 13:36:00 -0000 [thread overview] Message-ID: <20030422133600.23865.qmail@sources.redhat.com> (raw) The following reply was made to PR c/10450; it has been noted by GNATS. From: "Joseph S. Myers" <jsm28@cam.ac.uk> To: niva@niisi.msk.ru Cc: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Subject: Re: c/10450: gcc-3.2.2 produces error on initializing a structure with a constant expression Date: Tue, 22 Apr 2003 14:29:11 +0100 (BST) On Tue, 22 Apr 2003 niva@niisi.msk.ru wrote: > I think that this behaviour contradicts to C99, 6.7.8-13. And note that > gcc-2.95.3 compiles this code successfully. None of the cases you give is permitted by C99: compound literals are unnamed variables and are never constant expressions. It's simply that a few cases that used to be accepted as part of the GNU "constructor expressions" extension (which shared the syntax but not the semantics of compound literals) are for compatibility with old code still accepted in gnu89 mode. The standard is actually rather unclear about whether expressions of structure or union type can initialize a subaggregate at all (as part of initialization of an aggregate of automatic storage duration, where constant expressions are not required): whether the object to be initialized gets chosen according to the type of the initializer or whether it is always the most nested scalar object that is chosen. This may merit a DR (though for the last DR concerning lack of clarity in the description of initializers, DR#253, the committee decided that the standard was clear enough (but did at least say what it meant - which was the interpretation already followed in GCC)). -- Joseph S. Myers jsm28@cam.ac.uk
next reply other threads:[~2003-04-22 13:36 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-04-22 13:36 Joseph S. Myers [this message] -- strict thread matches above, loose matches on Subject: below -- 2003-04-22 23:03 bangerth 2003-04-22 10:46 niva
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20030422133600.23865.qmail@sources.redhat.com \ --to=jsm28@cam.ac.uk \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).