public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/99631] decltype of non-type template-parameter shouldn't be const
Date: Sun, 24 Sep 2023 18:42:45 +0000	[thread overview]
Message-ID: <bug-99631-4-xiHUJo5usV@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99631-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:b9e02590f7d35f1f8e8e95ab1f2e30f24113f551

commit r13-7835-gb9e02590f7d35f1f8e8e95ab1f2e30f24113f551
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Sep 19 08:21:05 2023 -0400

    c++: constness of decltype of NTTP object [PR99631]

    This corrects resolving decltype of a (class) NTTP object as per
    [dcl.type.decltype]/1.2 and [temp.param]/6 in the type-dependent case.

    Note that in the non-dependent case we resolve the decltype ahead of
    time, in which case finish_decltype_type drops the const VIEW_CONVERT_EXPR
    wrapper around the TEMPLATE_PARM_INDEX, and the latter has the desired
    non-const type.

    In the type-dependent case, at instantiation time tsubst drops the
    VIEW_CONVERT_EXPR since the substituted NTTP is the already-const object
    created by get_template_parm_object.  So in this case finish_decltype_type
    sees the const object, which this patch now adds special handling for.

            PR c++/99631

    gcc/cp/ChangeLog:

            * semantics.cc (finish_decltype_type): For an NTTP object,
            return its type modulo cv-quals.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/nontype-class60.C: New test.

    (cherry picked from commit ddd064e3571c4a9e6258c75eba65585a07367712)

  parent reply	other threads:[~2023-09-24 18:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-17 17:38 [Bug c++/99631] New: " johelegp at gmail dot com
2021-03-18 13:20 ` [Bug c++/99631] " redi at gcc dot gnu.org
2021-03-18 13:48 ` jakub at gcc dot gnu.org
2021-03-18 23:44 ` johelegp at gmail dot com
2021-11-09 17:23 ` n60wb42d2 at relay dot firefox.com
2022-09-26  1:46 ` johelegp at gmail dot com
2022-09-26  1:47 ` johelegp at gmail dot com
2022-12-26 17:10 ` pinskia at gcc dot gnu.org
2023-09-15 17:38 ` ppalka at gcc dot gnu.org
2023-09-15 17:39 ` ppalka at gcc dot gnu.org
2023-09-15 17:41 ` ppalka at gcc dot gnu.org
2023-09-19 12:21 ` cvs-commit at gcc dot gnu.org
2023-09-24 18:42 ` cvs-commit at gcc dot gnu.org [this message]
2023-09-24 18:44 ` ppalka at gcc dot gnu.org
2023-09-24 19:13 ` danakj at orodu dot net

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-99631-4-xiHUJo5usV@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).