This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/77542] __attribute__((warn_unused_result)) ignored on function template
- From: "afenkart at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 13 Sep 2016 07:21:28 +0000
- Subject: [Bug c++/77542] __attribute__((warn_unused_result)) ignored on function template
- Auto-submitted: auto-generated
- References: <bug-77542-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77542
--- Comment #2 from afenkart at gmail dot com ---
(In reply to Andrew Pinski from comment #1)
> Do you have a full example which shows the issue?
> In your case does ReturnValue have a copy constructor?
> If so this is a dup of bug 38172. Note C++17 defines [[nodiscard]] which
> should be used here instead really but it is only implemented in GCC 7.
It doesn't seem a duplicate of 38172, since the compiler emits a warning when
returning (non-trivial) struct. See attached example.