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++/53164] Undefined reference to template function instantiation Date: Thu, 21 Jul 2022 16:48:13 +0000 [thread overview] Message-ID: <bug-53164-4-EnB3EjxqP3@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-53164-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53164 --- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-12 branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:670ef5b108d0acfbde96f44b064079f2fa0c92d4 commit r12-8604-g670ef5b108d0acfbde96f44b064079f2fa0c92d4 Author: Patrick Palka <ppalka@redhat.com> Date: Mon Jun 6 14:29:12 2022 -0400 c++: function NTTP argument considered unused [PR53164, PR105848] Here at parse time the template argument f (an OVERLOAD) in A<f> gets resolved ahead of time to the FUNCTION_DECL f<int>, and we defer marking f<int> as used until instantiation (of g) as usual. Later when instantiating g the type A<f> (where f has already been resolved) is non-dependent, so tsubst_aggr_type avoids re-processing its template arguments, and we end up never actually marking f<int> as used (which means we never instantiate it) even though A<f>::h() later calls it, leading to a link error. This patch works around this issue by looking through ADDR_EXPR when calling mark_used on the substituted callee of a CALL_EXPR. PR c++/53164 PR c++/105848 gcc/cp/ChangeLog: * pt.cc (tsubst_copy_and_build) <case CALL_EXPR>: Look through an ADDR_EXPR callee when calling mark_used. gcc/testsuite/ChangeLog: * g++.dg/template/fn-ptr3.C: New test. (cherry picked from commit 733a792a2b2e1662e738fa358b45a2720a8618a7)
next prev parent reply other threads:[~2022-07-21 16:48 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-04-30 9:46 [Bug c++/53164] New: " poletti.marco at gmail dot com 2012-04-30 10:46 ` [Bug c++/53164] " redi at gcc dot gnu.org 2021-08-12 2:21 ` pinskia at gcc dot gnu.org 2021-10-05 14:25 ` ppalka at gcc dot gnu.org 2022-06-06 18:29 ` cvs-commit at gcc dot gnu.org 2022-07-21 16:48 ` cvs-commit at gcc dot gnu.org [this message] 2022-08-11 13:23 ` ppalka at gcc dot gnu.org 2023-04-01 14:19 ` 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-53164-4-EnB3EjxqP3@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: linkBe 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).