https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104486
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |mpolacek at gcc dot gnu.org, | |ppalka at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Perhaps we should ignore the warning if in_discarded_stmt ? Though it really matters where exactly the warning is reported, because in_discarded_stmt isn't set when parsing a template with if constexpr in it (after all, the condition might be dependent). Other option would be to temporarily disable selected warnings around where we set/restore in_discarded_stmt but also do it if processing_template_decl and the condition isn't dependent and folds to false or true.