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

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