public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "joseph at codesourcery dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/105510] error: initializer element is not constant
Date: Mon, 09 May 2022 20:39:33 +0000	[thread overview]
Message-ID: <bug-105510-4-cEJCWesr7Q@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105510-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105510

--- Comment #4 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
We have a documented extension:

    As a GNU extension, GCC allows initialization of objects with static
storage
    duration by compound literals (which is not possible in ISO C99 because
    the initializer is not a constant).
    It is handled as if the object were initialized only with the
brace-enclosed
    list if the types of the compound literal and the object match.
    The elements of the compound literal must be constant.
    If the object being initialized has array type of unknown size, the size is
    determined by the size of the compound literal.

So the question is whether this extension should also allow the case where 
a compound literal is used to initialize a sub-object.

  parent reply	other threads:[~2022-05-09 20:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-06 18:55 [Bug c/105510] New: [12] " 570070308 at qq dot com
2022-05-09  8:04 ` [Bug c/105510] " rguenth at gcc dot gnu.org
2022-05-09 12:21 ` 570070308 at qq dot com
2022-05-09 13:00 ` jakub at gcc dot gnu.org
2022-05-09 20:39 ` joseph at codesourcery dot com [this message]
2023-12-04 13:46 ` andy.shevchenko at gmail dot com

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=bug-105510-4-cEJCWesr7Q@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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: link
Be 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).