On 3/23/22 21:01, Pokechu22 via Gcc-patches wrote:
When cp_finish_decl calls cp_apply_type_quals_to_decl on a const auto or
constexpr auto variable, the type might not be complete the first time
(this happened when auto deduces to an initializer_list).
cp_apply_type_quals_to_decl removes the const qualifier if the type is
not complete, which is appropriate for grokdeclarator, on the assumption
that the type will be complete when called by cp_finish_decl.

Tested on x86_64 Ubuntu under WSL1 by bootstrapping and comparing results
from 24d51e749570dcb85bd43d3b528f58ad6141de26 with results from this
change.  As far as I can tell, this fixes Wunused-var-38.C and
Wunused-var-39.C without regressions.
(Wunused-var-37.C passed before this change.)

Thanks! For future reference, the patch doesn't apply easily because gmail wrapped lines; for sending patches via gmail you'll need to use attachments. Or you can use another MUA, or git send-email. This time I fixed the wrapping by hand, but that's a pain (especially since there's no "try again" flag to git am).

Also, like other DCO projects, we can't normally accept pseudonymous contributions. But as you say in the PR, this patch is trivial enough that I'm content to apply it myself; I want to make some adjustments anyway.

Currently GCC 12 development is in the regression fixes only stage, so I'll queue this for GCC 13.

Thanks again,
Jason

Reply via email to