[Bug target/80986] auto keyword variable lost its attributes

manjian2006 at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Jul 4 06:13:00 GMT 2017


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

--- Comment #5 from linzj <manjian2006 at gmail dot com> ---
Is the following patch okay? Or should I add the new bit to indicate not to
remove an attribute?
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index f8436b30b37..97bc82272af 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -7328,7 +7328,10 @@ canonicalize_type_argument (tree arg,
tsubst_flags_t complain)
   if (!arg || arg == error_mark_node || arg == TYPE_CANONICAL (arg))
     return arg;
   bool removed_attributes = false;
-  tree canon = strip_typedefs (arg, &removed_attributes);
+  bool *premove_attributes = NULL;
+  if (complain & tf_warning)
+    premove_attributes = &removed_attributes;
+  tree canon = strip_typedefs (arg, premove_attributes);
   if (removed_attributes
       && (complain & tf_warning))
     warning (OPT_Wignored_attributes,


More information about the Gcc-bugs mailing list