public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/107589] New: [C2x] `-Wold-style-declaration' triggers warning on `const auto'
@ 2022-11-09 13:14 pexu@gcc-bugzilla.mail.kapsi.fi
  0 siblings, 0 replies; only message in thread
From: pexu@gcc-bugzilla.mail.kapsi.fi @ 2022-11-09 13:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107589
           Summary: [C2x] `-Wold-style-declaration' triggers warning on
                    `const auto'
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pexu@gcc-bugzilla.mail.kapsi.fi
  Target Milestone: ---

Hi.

`-Wold-style-declaration' currently triggers warning when used with C2x `const
auto' (`auto const' is not affected).

Apparently the standard is a bit vague about this case.  Grammar `const auto'
is accepted by LLVM [1].  Also, the corresponding GCC testcases (c2x-auto-1.c
and c2x-auto-2.c) use `const auto' (not `auto const').

Using version `13.0.0 20221109 (experimental)':

# echo 'void f() { const auto x [[maybe_unused]] = 0; }' | gcc -c -xc -std=c2x
-Wold-style-declaration -
<stdin>: In function 'f':
<stdin>:1:1: warning: 'auto' is not at beginning of declaration
[-Wold-style-declaration]

[1] https://reviews.llvm.org/D133289

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-09 13:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-09 13:14 [Bug c/107589] New: [C2x] `-Wold-style-declaration' triggers warning on `const auto' pexu@gcc-bugzilla.mail.kapsi.fi

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).