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++/83258] Rejecting function pointer non-type template parameter without linkage
Date: Thu, 11 May 2023 14:05:03 +0000	[thread overview]
Message-ID: <bug-83258-4-6ppta1UYBt@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-83258-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #13 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:c3afdb8ba8f1839544c414f57e41a58c8fda5349

commit r14-708-gc3afdb8ba8f1839544c414f57e41a58c8fda5349
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu May 11 10:04:25 2023 -0400

    c++: converted lambda as template argument [PR83258, ...]

    r8-1253-g3d2e25a240c711 removed the template argument linkage requirement
    in convert_nontype_argument for C++17 (which r9-3836-g4be5c72cf3ea3e later
    factored out into invalid_tparm_referent_p), but we need to also remove
    the one in convert_nontype_argument_function for benefit of the first and
    third testcase which we currently reject even in C++17/20 mode.

    And in invalid_tparm_referent_p we're inadvertendly returning false for
    the address of a lambda's static op() since it's DECL_ARTIFICIAL, which
    currently causes us to reject the second (C++20) testcase.  But this
    DECL_ARTIFICIAL check seems to be relevant only for VAR_DECL, and in fact
    this code path was originally reachable only for VAR_DECL until recently
    (r13-6970-gb5e38b1c166357).  So this patch restricts the check to VAR_DECL.

    Co-authored-by: Jonathan Wakely <jwakely@redhat.com>

            PR c++/83258
            PR c++/80488
            PR c++/97700

    gcc/cp/ChangeLog:

            * pt.cc (convert_nontype_argument_function): Remove linkage
            requirement for C++17 and later.
            (invalid_tparm_referent_p) <case ADDR_EXPR>: Restrict
            DECL_ARTIFICIAL rejection test to VAR_DECL.

    gcc/testsuite/ChangeLog:

            * g++.dg/ext/visibility/anon8.C: Don't expect a "no linkage"
            error for the template argument &B2:fn in C++17 mode.
            * g++.dg/cpp0x/lambda/lambda-conv15.C: New test.
            * g++.dg/cpp2a/nontype-class56.C: New test.
            * g++.dg/template/function2.C: New test.

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

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-83258-4@http.gcc.gnu.org/bugzilla/>
2020-03-17 18:17 ` herring at lanl dot gov
2020-08-26 15:51 ` ma.noack.pr at gmail dot com
2021-03-13 19:44 ` johelegp at gmail dot com
2021-03-13 21:51 ` johelegp at gmail dot com
2021-12-04  1:01 ` pinskia at gcc dot gnu.org
2021-12-20  4:10 ` egallager at gcc dot gnu.org
2023-05-11 14:05 ` cvs-commit at gcc dot gnu.org [this message]
2023-05-11 14:25 ` ppalka at gcc dot gnu.org
2023-05-12 12:38 ` cvs-commit at gcc dot gnu.org
2023-05-12 15:08 ` cvs-commit at gcc dot gnu.org
2023-05-12 15:08 ` cvs-commit at gcc dot gnu.org
2023-05-12 15:25 ` ppalka 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-83258-4-6ppta1UYBt@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).