public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99361] New: "unused variable" warning on a used variable in template lambda
@ 2021-03-03 14:54 hewillk at gmail dot com
  2021-03-03 17:24 ` [Bug c++/99361] " mpolacek at gcc dot gnu.org
  2021-03-10 17:29 ` hewillk at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: hewillk at gmail dot com @ 2021-03-03 14:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99361
           Summary: "unused variable" warning on a used variable in
                    template lambda
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

The following code:

auto f() {
  const auto x = 1;
  return [] (auto) { return x; };
}

will emit unused variable warnings with "-std=c++20 -Wall" flags:

<source>: In function 'auto f()':
<source>:2:14: warning: variable 'x' set but not used
[-Wunused-but-set-variable]
    2 |   const auto x = 1;
      |     

godbolt: https://godbolt.org/z/d54j4G

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/99361] "unused variable" warning on a used variable in template lambda
  2021-03-03 14:54 [Bug c++/99361] New: "unused variable" warning on a used variable in template lambda hewillk at gmail dot com
@ 2021-03-03 17:24 ` mpolacek at gcc dot gnu.org
  2021-03-10 17:29 ` hewillk at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-03-03 17:24 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |mpolacek at gcc dot gnu.org
   Last reconfirmed|                            |2021-03-03
           Keywords|                            |diagnostic
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/99361] "unused variable" warning on a used variable in template lambda
  2021-03-03 14:54 [Bug c++/99361] New: "unused variable" warning on a used variable in template lambda hewillk at gmail dot com
  2021-03-03 17:24 ` [Bug c++/99361] " mpolacek at gcc dot gnu.org
@ 2021-03-10 17:29 ` hewillk at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: hewillk at gmail dot com @ 2021-03-10 17:29 UTC (permalink / raw)
  To: gcc-bugs

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

康桓瑋 <hewillk at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED

--- Comment #2 from 康桓瑋 <hewillk at gmail dot com> ---
This is a duplicate of 96311.

*** This bug has been marked as a duplicate of bug 96311 ***

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-10 17:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-03 14:54 [Bug c++/99361] New: "unused variable" warning on a used variable in template lambda hewillk at gmail dot com
2021-03-03 17:24 ` [Bug c++/99361] " mpolacek at gcc dot gnu.org
2021-03-10 17:29 ` hewillk at gmail dot com

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