public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Alejandro Colomar <alx@kernel.org>
Cc: GCC <gcc@gcc.gnu.org>
Subject: Re: Confusing location of error in source code
Date: Fri, 1 Sep 2023 07:49:05 +0100	[thread overview]
Message-ID: <CAH6eHdQnb5U19WfSWGBRED8HESb3-XZMoEADrapHLiO1yFNYXQ@mail.gmail.com> (raw)
In-Reply-To: <e6fd6e6d-af8d-e2e0-e980-076cbf7dc751@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 889 bytes --]

On Thu, 31 Aug 2023, 17:05 Alejandro Colomar via Gcc, <gcc@gcc.gnu.org>
wrote:

> Hi!
>
> I've been confused for some time with a compilation error that
> pointed to a slightly-off location.  I wasn't seeing that I used
> a temporary variable in a constant expression.  The code could be
> reduced to:
>
> $ cat const.c
> int
> main(void)
> {
>         int x = 42;
>
>         _Static_assert(0 || 7 > x, "");
> }
> $ cc -Wall -Wextra const.c
> const.c: In function ‘main’:
> const.c:6:26: error: expression in static assertion is not constant
>     6 |         _Static_assert(0 || 7 > x, "");
>       |                        ~~^~~~~~~~
>
>
> I think the appropriate error report should point to this other point:
>
>
>     6 |         _Static_assert(0 || 7 > x, "");
>       |                        ~~~~~~~~~^
>

Please use bugzilla for bug reports.

  reply	other threads:[~2023-09-01  6:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-31 16:04 Alejandro Colomar
2023-09-01  6:49 ` Jonathan Wakely [this message]
2023-09-01 13:17   ` Alejandro Colomar

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=CAH6eHdQnb5U19WfSWGBRED8HESb3-XZMoEADrapHLiO1yFNYXQ@mail.gmail.com \
    --to=jwakely.gcc@gmail.com \
    --cc=alx@kernel.org \
    --cc=gcc@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).