https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68965
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> --- This seems to fix it and hopefully doesn't regress anything... --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -11924,6 +11924,9 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) /* Rename the parameter to include the index. */ DECL_NAME (r) = make_ith_pack_parameter_name (DECL_NAME (r), i); + + /* Set TREE_USED for the benefit of -Wunused. */ + TREE_USED (r) = true; } else if (!type) /* We're dealing with a normal parameter. */