public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54379] New: Suggestion for type attribute similar to warn_unused_result
@ 2012-08-26 23:13 jewillco at osl dot iu.edu
  2021-05-31 21:16 ` [Bug c++/54379] " redi at gcc dot gnu.org
  2021-09-17  6:41 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: jewillco at osl dot iu.edu @ 2012-08-26 23:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54379

             Bug #: 54379
           Summary: Suggestion for type attribute similar to
                    warn_unused_result
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jewillco@osl.iu.edu


I think it would be useful to extend GCC with an attribute similar to
`warn_unused_result` but applying to a user-defined type rather than just a
single function.  The effect would be that all expressions (variable
references, function calls, etc.) that return some object of that type would
warn if their results were unused.  The intended use case is for C++ patterns
such as expression templates in which purely-functional code builds up an
expression tree which does not make sense to discard; in some cases, operator=
would just add to the expression tree as well, leading to a source of bugs. 
This would probably require the kind of cast-to-void override mechanism that PR
25509 is about, since these annotations would strictly be recommendations.


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

* [Bug c++/54379] Suggestion for type attribute similar to warn_unused_result
  2012-08-26 23:13 [Bug c++/54379] New: Suggestion for type attribute similar to warn_unused_result jewillco at osl dot iu.edu
@ 2021-05-31 21:16 ` redi at gcc dot gnu.org
  2021-09-17  6:41 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2021-05-31 21:16 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Yes I think this can be closed. C++ supports this directly now, without needing
GCC extensions.

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

* [Bug c++/54379] Suggestion for type attribute similar to warn_unused_result
  2012-08-26 23:13 [Bug c++/54379] New: Suggestion for type attribute similar to warn_unused_result jewillco at osl dot iu.edu
  2021-05-31 21:16 ` [Bug c++/54379] " redi at gcc dot gnu.org
@ 2021-09-17  6:41 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-17  6:41 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |7.0

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

end of thread, other threads:[~2021-09-17  6:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-26 23:13 [Bug c++/54379] New: Suggestion for type attribute similar to warn_unused_result jewillco at osl dot iu.edu
2021-05-31 21:16 ` [Bug c++/54379] " redi at gcc dot gnu.org
2021-09-17  6:41 ` pinskia 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).