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++/109480] [11/12/13/14 Regression] non-depedent access goes wrong in a template method sometimes since r11-1350-g92bed036098928
Date: Sun, 07 May 2023 14:29:55 +0000	[thread overview]
Message-ID: <bug-109480-4-NMcXPdMhmG@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109480-4@http.gcc.gnu.org/bugzilla/>

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

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

https://gcc.gnu.org/g:7f4840ddef9746ab591c78ecdd750e3b18aa1ce6

commit r14-556-g7f4840ddef9746ab591c78ecdd750e3b18aa1ce6
Author: Patrick Palka <ppalka@redhat.com>
Date:   Sun May 7 10:24:49 2023 -0400

    c++: potentiality of templated memfn call [PR109480]

    Here we're incorrectly deeming the templated call a.g() inside b's
    initializer as potentially constant, despite g being non-constexpr,
    which leads to us needlessly instantiating the initializer ahead of time
    and which subsequently triggers a bug in access checking deferral (to be
    fixed by the follow-up patch).

    This patch fixes this by calling get_fns earlier during CALL_EXPR
    potentiality checking so that when we extract a FUNCTION_DECL out of a
    templated member function call (whose overall callee is typically a
    COMPONENT_REF) we do the usual constexpr-eligibility checking for it.

    In passing, I noticed the nearby special handling of the object argument
    of a non-static member function call is effectively the same as the
    generic argument handling a few lines below.  So this patch just gets
    rid of this special handling; otherwise we'd have to adapt it to handle
    templated versions of such calls.

            PR c++/109480

    gcc/cp/ChangeLog:

            * constexpr.cc (potential_constant_expression_1) <case CALL_EXPR>:
            Reorganize to call get_fns sooner.  Remove special handling of
            the object argument of a non-static member function call.  Remove
            dead store to 'fun'.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/noexcept59.C: Make e() constexpr so that the
            expected "without object" diagnostic isn't replaced by a
            "call to non-constexpr function" diagnostic.
            * g++.dg/template/non-dependent25.C: New test.

  parent reply	other threads:[~2023-05-07 14:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-12  5:38 [Bug c++/109480] New: g++-12 and g++-11 failed to compile the attached source file while g++-10 and clang can ishikawa at yk dot rim.or.jp
2023-04-12  5:51 ` [Bug c++/109480] " pinskia at gcc dot gnu.org
2023-04-12  6:02 ` [Bug c++/109480] [11/12/13 Regression] non-depedent access goes wrong in a template method sometimes pinskia at gcc dot gnu.org
2023-04-12  6:06 ` pinskia at gcc dot gnu.org
2023-04-12  6:55 ` [Bug c++/109480] [11/12/13 Regression] non-depedent access goes wrong in a template method sometimes since r11-1350-g92bed036098928 marxin at gcc dot gnu.org
2023-04-12 10:31 ` rguenth at gcc dot gnu.org
2023-04-12 12:40 ` ppalka at gcc dot gnu.org
2023-05-07 14:29 ` cvs-commit at gcc dot gnu.org [this message]
2023-05-07 14:30 ` [Bug c++/109480] [11/12/13/14 " cvs-commit at gcc dot gnu.org
2023-05-07 14:31 ` [Bug c++/109480] [11/12/13 " ppalka at gcc dot gnu.org
2023-05-29 10:08 ` jakub 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-109480-4-NMcXPdMhmG@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).