public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94492] New: no way to silence -Wdeprecated-copy for aggregates
@ 2020-04-05 20:13 nok.raven at gmail dot com
2020-04-06 20:06 ` [Bug c++/94492] " redi at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: nok.raven at gmail dot com @ 2020-04-05 20:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94492
Bug ID: 94492
Summary: no way to silence -Wdeprecated-copy for aggregates
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nok.raven at gmail dot com
Target Milestone: ---
There is no way to silence the warning without making a type non-aggregate.
A simplified case from Boost.Proto:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
struct expr
{
int a, b;
expr& operator=(const expr&) { return *this; }
};
#pragma GCC diagnostic pop
#include <type_traits>
static_assert(std::is_aggregate_v<expr>);
expr foo(expr e)
{
return e;
}
<source>: In function 'expr foo(expr)':
<source>:15:12: error: implicitly-declared 'constexpr expr::expr(const expr&)'
is deprecated [-Werror=deprecated-copy]
15 | return e;
| ^
<source>:6:11: note: because 'expr' has user-provided 'expr&
expr::operator=(const expr&)'
6 | expr& operator=(const expr&) { return *this; }
| ^~~~~~~~
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/94492] no way to silence -Wdeprecated-copy for aggregates
2020-04-05 20:13 [Bug c++/94492] New: no way to silence -Wdeprecated-copy for aggregates nok.raven at gmail dot com
@ 2020-04-06 20:06 ` redi at gcc dot gnu.org
2021-04-27 21:12 ` jason at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2020-04-06 20:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94492
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2020-04-06
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/94492] no way to silence -Wdeprecated-copy for aggregates
2020-04-05 20:13 [Bug c++/94492] New: no way to silence -Wdeprecated-copy for aggregates nok.raven at gmail dot com
2020-04-06 20:06 ` [Bug c++/94492] " redi at gcc dot gnu.org
@ 2021-04-27 21:12 ` jason at gcc dot gnu.org
2021-06-01 15:38 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2021-04-27 21:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94492
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
Status|NEW |ASSIGNED
CC| |jason at gcc dot gnu.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/94492] no way to silence -Wdeprecated-copy for aggregates
2020-04-05 20:13 [Bug c++/94492] New: no way to silence -Wdeprecated-copy for aggregates nok.raven at gmail dot com
2020-04-06 20:06 ` [Bug c++/94492] " redi at gcc dot gnu.org
2021-04-27 21:12 ` jason at gcc dot gnu.org
@ 2021-06-01 15:38 ` cvs-commit at gcc dot gnu.org
2021-06-03 1:52 ` nok.raven at gmail dot com
2021-08-11 20:41 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-01 15:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94492
--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
https://gcc.gnu.org/g:620cd7861e1266991c9c2a82e1e2d5f4d723ec88
commit r12-1144-g620cd7861e1266991c9c2a82e1e2d5f4d723ec88
Author: Jason Merrill <jason@redhat.com>
Date: Tue Apr 27 17:13:39 2021 -0400
c++: -Wdeprecated-copy and #pragma diagnostic [PR94492]
-Wdeprecated-copy was depending only on the state of the warning at the
point where we call the function, making it hard to use #pragma diagnostic
to suppress the warning for a particular implicitly declared function.
But checking whether the warning is enabled at the location of the implicit
declaration turned out to be a bit complicated; option_enabled only tests
whether it was enabled at the start of compilation, the actual test only
existed in the middle of diagnostic_report_diagnostic. So this patch
factors it out and adds a new warning_enabled function to diagnostic.h.
gcc/ChangeLog:
PR c++/94492
* diagnostic.h (warning_enabled_at): Declare.
* diagnostic.c (diagnostic_enabled): Factor out from...
(diagnostic_report_diagnostic): ...here.
(warning_enabled_at): New.
gcc/cp/ChangeLog:
PR c++/94492
* decl2.c (cp_warn_deprecated_use): Check warning_enabled_at.
gcc/testsuite/ChangeLog:
PR c++/94492
* g++.dg/cpp0x/depr-copy4.C: New test.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/94492] no way to silence -Wdeprecated-copy for aggregates
2020-04-05 20:13 [Bug c++/94492] New: no way to silence -Wdeprecated-copy for aggregates nok.raven at gmail dot com
` (2 preceding siblings ...)
2021-06-01 15:38 ` cvs-commit at gcc dot gnu.org
@ 2021-06-03 1:52 ` nok.raven at gmail dot com
2021-08-11 20:41 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: nok.raven at gmail dot com @ 2021-06-03 1:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94492
--- Comment #2 from Nikita Kniazev <nok.raven at gmail dot com> ---
Could this be backported? The issue affects every release with
-Wdeprecated-copy, which are GCC 9+.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/94492] no way to silence -Wdeprecated-copy for aggregates
2020-04-05 20:13 [Bug c++/94492] New: no way to silence -Wdeprecated-copy for aggregates nok.raven at gmail dot com
` (3 preceding siblings ...)
2021-06-03 1:52 ` nok.raven at gmail dot com
@ 2021-08-11 20:41 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-11 20:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94492
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |12.0
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-08-11 20:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-05 20:13 [Bug c++/94492] New: no way to silence -Wdeprecated-copy for aggregates nok.raven at gmail dot com
2020-04-06 20:06 ` [Bug c++/94492] " redi at gcc dot gnu.org
2021-04-27 21:12 ` jason at gcc dot gnu.org
2021-06-01 15:38 ` cvs-commit at gcc dot gnu.org
2021-06-03 1:52 ` nok.raven at gmail dot com
2021-08-11 20: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).