public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Patrick Palka <ppalka@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-6847] c++: Fix non-portable default argument of make_auto_1 [PR104197]
Date: Mon, 24 Jan 2022 16:48:18 +0000 (GMT)	[thread overview]
Message-ID: <20220124164818.8736E3858D3C@sourceware.org> (raw)

https://gcc.gnu.org/g:b1aa2a3cf1ba233ccd5a49fde85a2ca7e5f620e9

commit r12-6847-gb1aa2a3cf1ba233ccd5a49fde85a2ca7e5f620e9
Author: Patrick Palka <ppalka@redhat.com>
Date:   Mon Jan 24 11:47:13 2022 -0500

    c++: Fix non-portable default argument of make_auto_1 [PR104197]
    
    Avoid using the macro current_template_depth, which expands to an
    expression that uses __FUNCTION__, within the signature of a function.
    
            PR c++/104197
    
    gcc/cp/ChangeLog:
    
            * pt.cc (make_auto_1): Use -1 as a placeholder default argument
            for level.

Diff:
---
 gcc/cp/pt.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index bba62a5800a..8f50b9c4d3c 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -28477,9 +28477,10 @@ make_args_non_dependent (vec<tree, va_gc> *args)
    by default.  If set_canonical is true, we set TYPE_CANONICAL on it.  */
 
 static tree
-make_auto_1 (tree name, bool set_canonical,
-	     int level = current_template_depth + 1)
+make_auto_1 (tree name, bool set_canonical, int level = -1)
 {
+  if (level == -1)
+    level = current_template_depth + 1;
   tree au = cxx_make_type (TEMPLATE_TYPE_PARM);
   TYPE_NAME (au) = build_decl (input_location, TYPE_DECL, name, au);
   TYPE_STUB_DECL (au) = TYPE_NAME (au);


                 reply	other threads:[~2022-01-24 16:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220124164818.8736E3858D3C@sourceware.org \
    --to=ppalka@gcc.gnu.org \
    --cc=gcc-cvs@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).