On Tue, Jul 20, 2021 at 01:47:01PM -0600, Martin Sebor wrote: > > Addressing that is for another day. > > David Malcolm (CC'd) has a patch attached to pr63326 to issue > a warning to point out that #pragmas are treated as statements > that would help prevent this type of a bug. David, do you still > plan to submit it?
That patch doesn't look correct. c_parser_pragma and cp_parser_pragma is already told if it appears in a context for which treating the pragma as standalone statement changes the behavior and in contexts where it doesn't - pragma_stmt stands for the problematic ones, pragma_compound for the correct ones (there are other values for namespace scope, class scope etc.). OpenMP/OpenACC pragmas shouldn't be touched, those already do the right thing the standard asks for, for the remaining ones there should be a warning for the pragma_stmt cases. Jakub