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);

Reply via email to