public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ppalka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/96330] Constexpr variables cannot be used in the template context.
Date: Fri, 05 Mar 2021 16:43:45 +0000 [thread overview]
Message-ID: <bug-96330-4-Xbnt1y6qR3@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96330-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96330
--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #1)
> Tried
> --- gcc/cp/pt.c.jj 2020-07-27 10:38:19.000000000 +0200
> +++ gcc/cp/pt.c 2020-07-27 17:25:09.748240198 +0200
> @@ -16838,14 +16838,17 @@ tsubst_copy (tree t, tree args, tsubst_f
> case TEMPLATE_ID_EXPR:
> {
> /* Substituted template arguments */
> - tree fn = TREE_OPERAND (t, 0);
> + tree expr = TREE_OPERAND (t, 0);
> tree targs = TREE_OPERAND (t, 1);
>
> - fn = tsubst_copy (fn, args, complain, in_decl);
> + expr = tsubst_copy (expr, args, complain, in_decl);
> if (targs)
> targs = tsubst_template_args (targs, args, complain, in_decl);
>
> - return lookup_template_function (fn, targs);
> + if (variable_template_p (expr))
> + return lookup_and_finish_template_variable (expr, targs, complain);
> + else
> + return lookup_template_function (expr, targs);
> }
>
> case TREE_LIST:
> but that just means an ICE elsewhere.
Hmm, seems using lookup_template_variable instead of
lookup_and_finish_template_variable works.
next prev parent reply other threads:[~2021-03-05 16:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-27 11:55 [Bug c++/96330] New: " steve_green at qq dot com
2020-07-27 15:35 ` [Bug c++/96330] " jakub at gcc dot gnu.org
2021-03-05 16:43 ` ppalka at gcc dot gnu.org [this message]
2021-03-06 5:08 ` cvs-commit at gcc dot gnu.org
2021-03-06 15:26 ` 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-96330-4-Xbnt1y6qR3@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).