public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/104197] [12 Regression] clang: gcc/cp/pt.cc:28481:19: warning: predefined identifier is only valid inside function [-Wpredefined-identifier-outside-function]
Date: Mon, 24 Jan 2022 08:30:30 +0000	[thread overview]
Message-ID: <bug-104197-4-B7mSwyus89@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104197-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Something like this will fix the warning:
apinski@xeond:~/src/upstream-gcc-git/gcc/gcc/cp$ git diff
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index bba62a5800a..33969fc646c 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -28477,9 +28477,13 @@ 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, bool level0 = false)
 {
+  int level;
+  if (!level0)
+    level = current_template_depth + 1;
+  else
+    level = 0;
   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);
@@ -28514,7 +28518,7 @@ make_auto (void)
 tree
 make_template_placeholder (tree tmpl)
 {
-  tree t = make_auto_1 (auto_identifier, false, /*level=*/0);
+  tree t = make_auto_1 (auto_identifier, false, /*level0=*/true);
   CLASS_PLACEHOLDER_TEMPLATE (t) = tmpl;
   /* Our canonical type depends on the placeholder.  */
   TYPE_CANONICAL (t) = canonical_type_parameter (t);

  parent reply	other threads:[~2022-01-24  8:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-24  7:59 [Bug c++/104197] New: " marxin at gcc dot gnu.org
2022-01-24  8:20 ` [Bug c++/104197] " pinskia at gcc dot gnu.org
2022-01-24  8:23 ` pinskia at gcc dot gnu.org
2022-01-24  8:23 ` [Bug c++/104197] [12 Regression] " pinskia at gcc dot gnu.org
2022-01-24  8:30 ` pinskia at gcc dot gnu.org [this message]
2022-01-24  8:32 ` pinskia at gcc dot gnu.org
2022-01-24  9:25 ` rguenth at gcc dot gnu.org
2022-01-24 14:33 ` ppalka at gcc dot gnu.org
2022-01-24 16:48 ` cvs-commit at gcc dot gnu.org
2022-01-24 16:48 ` 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-104197-4-B7mSwyus89@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).