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++/92687] decltype of a structured binding to a tuple component is a reference type inside a template function
Date: Wed, 28 Feb 2024 13:44:09 +0000	[thread overview]
Message-ID: <bug-92687-4-H42Ss0hOZq@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-92687-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
finish_decltype_type does:
      /* decltype of a decomposition name drops references in the tuple case
         (unlike decltype of a normal variable) and keeps cv-qualifiers from
         the containing object in the other cases (unlike decltype of a member
         access expression).  */
      if (DECL_DECOMPOSITION_P (expr))
        {
          if (DECL_HAS_VALUE_EXPR_P (expr))
            /* Expr is an array or struct subobject proxy, handle
               bit-fields properly.  */
            return unlowered_expr_type (expr);
          else
            /* Expr is a reference variable for the tuple case.  */
            return lookup_decomp_type (expr);
        }
The problem is that if processing_template_decl (though, finish_decltype_type
has processing_template_decl temporarily cleared here) and expr is not
dependent (otherwise finish_decltype_type would defer handling it)
DECL_HAS_VALUE_EXPR_P is actually set on all the structured binding decls, not
just when it is array/struct/vector/complex etc. subobject proxy.

  parent reply	other threads:[~2024-02-28 13:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-92687-4@http.gcc.gnu.org/bugzilla/>
2024-02-28 11:56 ` Christopher.Nerz at de dot bosch.com
2024-02-28 12:15 ` jakub at gcc dot gnu.org
2024-02-28 13:44 ` jakub at gcc dot gnu.org [this message]
2024-02-28 14:31 ` jakub at gcc dot gnu.org
2024-03-01 16:28 ` cvs-commit 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-92687-4-H42Ss0hOZq@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).