https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101106
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- 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); + } } DECL_DELETED_FN (newdecl) |= DECL_DELETED_FN (olddecl); }