https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101106
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #2) > This was intentionally changed from an error to a pedwarn by r11-1454 > > > c++: Treat in-class default/delete as definitions. > > We were complaining about a constrained defaulted non-template friend in > a > template class because funcdef_flag wasn't set. grokdeclarator would > set it > for default/delete, but grokfield wasn't passing the 'initialized' values > needed. Fixing that revealed some errors in existing tests that we > weren't > diagnosing. Since we accepted them for so long, I'm reducing the error > to a > pedwarn to ease compiler upgrade. > > gcc/cp/ChangeLog: > > * decl2.c (grokfield): Pass SD_DEFAULTED and SD_DELETED. > * decl.c (duplicate_decls): Reduce error for delete > after earlier declaration to pedwarn. > > The fix would be: > > --- a/gcc/cp/decl.c > +++ b/gcc/cp/decl.c > @@ -2170,11 +2170,13 @@ duplicate_decls (tree newdecl, tree olddecl, bool > hiding, bool was_hidden) > if (DECL_DELETED_FN (newdecl)) > { > auto_diagnostic_group d; > - pedwarn (newdecl_loc, OPT_Wpedantic, > - "deleted definition of %qD is not first declaration", > - newdecl); > - inform (olddecl_loc, > - "previous declaration of %qD", olddecl); > + if (pedwarn (newdecl_loc, OPT_Wpedantic, > + "deleted definition of %qD is not first > declaration", > + newdecl); > + { > + inform (olddecl_loc, > + "previous declaration of %qD", olddecl); > + } Except for the {}s around inform, those aren't needed. Otherwise LGTM (even obvious).