public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109235] New: nodiscard attribute ignored with deduction guide
@ 2023-03-21 15:23 tejo@bang-olufsen.dk
  2023-03-21 15:25 ` [Bug c++/109235] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: tejo@bang-olufsen.dk @ 2023-03-21 15:23 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109235
           Summary: nodiscard attribute ignored with deduction guide
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tejo@bang-olufsen.dk
  Target Milestone: ---

I have tried implementing std::experimental::scope_exit and since this is a
RAII object, I marked it with [[nodiscard]] to ensure all instances are
assigned to a variable.

It appears, however, that GCC ignores the nodiscard attribute when a deduction
guide is present. See this Godbolt link for an example:

https://godbolt.org/z/v9e8dqW1o

Notice how Clang correctly flags the problem.

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

end of thread, other threads:[~2023-03-22 13:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-21 15:23 [Bug c++/109235] New: nodiscard attribute ignored with deduction guide tejo@bang-olufsen.dk
2023-03-21 15:25 ` [Bug c++/109235] " pinskia at gcc dot gnu.org
2023-03-21 15:29 ` [Bug c++/109235] nodiscard attribute ignored on temporary created pinskia at gcc dot gnu.org
2023-03-21 15:30 ` [Bug c++/109235] nodiscard attribute on class not copied to the constructors pinskia at gcc dot gnu.org
2023-03-21 15:31 ` pinskia at gcc dot gnu.org
2023-03-21 15:32 ` pinskia at gcc dot gnu.org
2023-03-22 13:30 ` redi at gcc dot gnu.org

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