public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx@kernel.org>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: GCC <gcc@gcc.gnu.org>
Subject: Re: Confusing location of error in source code
Date: Fri, 1 Sep 2023 15:17:08 +0200	[thread overview]
Message-ID: <ccdba6c6-56c6-ba64-e544-cd0d34c07467@kernel.org> (raw)
In-Reply-To: <CAH6eHdQnb5U19WfSWGBRED8HESb3-XZMoEADrapHLiO1yFNYXQ@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1137 bytes --]

Hi Jonathan,

On 2023-09-01 08:49, Jonathan Wakely wrote:
> 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.

Sure, will do.  Thanks!

Alex

> 

-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2023-09-01 13:17 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
2023-09-01 13:17   ` Alejandro Colomar [this message]

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=ccdba6c6-56c6-ba64-e544-cd0d34c07467@kernel.org \
    --to=alx@kernel.org \
    --cc=gcc@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    /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).