https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80986
--- Comment #6 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> --- (In reply to linzj from comment #5) > 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, Please discuss this further on the mailing list ...