From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 51349385B534; Thu, 11 May 2023 14:05:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 51349385B534 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683813906; bh=1UvXPJa8kz4DWF0X/GADVDtGrEQBiG+u53ZSey/oMCY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=aKuj9CqVKvIwOqaB7xE6IeJyuMDIrKvNMNk4OCYW7vtLJ80e7Y+rSfb4n6h2uD9c5 JklhUs7E4vQD6ogdHqZw0ic1plIKj4bpbFJjBtJPzZZM0NTnPTjEHzftihzAELAGXb 6a+XDxE7+2OA1vUh9kGnwEfXFRvFRsHu+exrdhCg= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/97700] Bogus error when a class containing a function pointer is used as a non-type template parameter Date: Thu, 11 May 2023 14:05:05 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97700 --- Comment #7 from CVS Commits --- The master branch has been updated by Patrick Palka : https://gcc.gnu.org/g:c3afdb8ba8f1839544c414f57e41a58c8fda5349 commit r14-708-gc3afdb8ba8f1839544c414f57e41a58c8fda5349 Author: Patrick Palka Date: Thu May 11 10:04:25 2023 -0400 c++: converted lambda as template argument [PR83258, ...] r8-1253-g3d2e25a240c711 removed the template argument linkage requireme= nt in convert_nontype_argument for C++17 (which r9-3836-g4be5c72cf3ea3e la= ter 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 a= nd 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 fa= ct this code path was originally reachable only for VAR_DECL until recently (r13-6970-gb5e38b1c166357). So this patch restricts the check to VAR_D= ECL. Co-authored-by: Jonathan Wakely 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) : 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.=