public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/98423] The defaulted default constructor defined as deleted when one of variant member has a default member initializer
Date: Mon, 28 Dec 2020 11:58:32 +0000	[thread overview]
Message-ID: <bug-98423-4-jLwng4BypY@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98423-4@http.gcc.gnu.org/bugzilla/>

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org,
                   |                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think it isn't solely about the process_subob_fn
      if (TREE_CODE (arg) == FIELD_DECL
          && TREE_CODE (DECL_CONTEXT (arg)) == UNION_TYPE)
        {
          if (deleted_p)
            *deleted_p = true;
          if (diag)
            error ("union member %q+D with non-trivial %qD", arg, fn);
        }
diagnostics that probably shouldn't be performed if the union type has nsdmi on
any member, isn't it also the:
  if (constexpr_p && !DECL_DECLARED_CONSTEXPR_P (fn))
    {
      *constexpr_p = false;
      if (diag)
        {
          inform (DECL_SOURCE_LOCATION (fn),
                  SFK_DTOR_P (sfk)
                  ? G_("defaulted destructor calls non-%<constexpr%> %qD")
                  : G_("defaulted constructor calls non-%<constexpr%> %qD"),
                  fn);
          explain_invalid_constexpr_fn (fn);
        }
    }
diagnostics (why would a default constructor of a union be non-constexpr just
because some variant member without nsdmi has non-constexpr default
constructor), perhaps the spec_p stuff too.
So for UNION_TYPE we probably want to search for nsdmis in another loop at the
start of walk_field_subobs and punt some tests for some special members if
there are any nsdmis.

  reply	other threads:[~2020-12-28 11:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-23  2:47 [Bug c++/98423] New: " xmh970252187 at gmail dot com
2020-12-28 11:58 ` jakub at gcc dot gnu.org [this message]
2020-12-28 11:59 ` [Bug c++/98423] " jakub at gcc dot gnu.org
2022-07-20 22:14 ` jason at gcc dot gnu.org
2022-07-22  5:43 ` jason at gcc dot gnu.org
2022-07-22  7:23 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-98423-4-jLwng4BypY@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).