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/69960] "initializer element is not constant"
Date: Wed, 22 Feb 2023 17:00:25 +0000 [thread overview]
Message-ID: <bug-69960-4-6KpnERF4aq@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-69960-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69960
--- Comment #21 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
On Wed, 22 Feb 2023, daniel.lundin.mail at gmail dot com via Gcc-bugs wrote:
> First of all, it is questionable if gcc is still conforming after the change
> discussed here and implemented as per gcc 8.0. Yes "an implementation may
> accept other forms of constant expressions" but that doesn't mean that a
> compiler is allowed to ignore the constraints in C17 6.7.9/4 nor the definition
> of an integer constant expression. So this ought to explicitly be a compiler
> extension and we ought to have a way to reliably compile strictly conforming
> programs with gcc without constraint violations silently getting ignored.
"integer constant expression" does not mean the same thing as "constant
expression of integer type". If you use this expression in a context
requiring an integer constant expression (case label, bit-field width,
array designator in initializer, enum value, array size at file scope,
constexpr initializer for object of integer type, etc.), it's properly
rejected as required; in contexts where both integer constant expressions
and other expressions are valid but with different semantics (e.g.
determining whether something is a null pointer constant, determining
whether an array is a VLA in a context where both VLA and non-VLA arrays
are valid), again it's treated as non-constant.
next prev parent reply other threads:[~2023-02-22 17:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-69960-4@http.gcc.gnu.org/bugzilla/>
2021-09-27 20:42 ` pinskia at gcc dot gnu.org
2023-02-22 10:14 ` daniel.lundin.mail at gmail dot com
2023-02-22 11:47 ` daniel.lundin.mail at gmail dot com
2023-02-22 17:00 ` joseph at codesourcery dot com [this message]
2023-02-22 17:03 ` joseph at codesourcery dot com
2023-02-23 7:43 ` daniel.lundin.mail at gmail dot com
2023-02-23 18:38 ` joseph at codesourcery dot com
2023-02-24 7:52 ` daniel.lundin.mail 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-69960-4-6KpnERF4aq@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).