https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118112
Bug ID: 118112 Summary: Unhelpful "too many arguments to function" error message Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: dmalcolm at gcc dot gnu.org Target Milestone: --- Seen attempting to build 389-ds-base with gcc 15: https://bugzilla.redhat.com/show_bug.cgi?id=2333039 I see this failure: ldap/servers/slapd/compare.c: In function 'do_compare': ldap/servers/slapd/compare.c:184:19: error: too many arguments to function 'be->be_database->plg_un.plg_un_db.plg_un_db_compare' 184 | rc = (*be->be_compare)(pb); | ~^~~~~~~~~~~~~~~~ whereas the build succeeded with gcc 14. There is no note from c-typeck.cc's inform_declaration as we don't have a funcdecl, just an expression that's a callback field of function type. Looking at the source I see: slap.h:1467:#define be_compare be_database->plg_compare struct slapdplugin *be_database; /* single plugin */ #define plg_compare plg_un.plg_un_db.plg_un_db_compare slap.h:1074: IFP plg_un_db_compare; /* compare */ where slapi-private.h has: /* JCMREPL - IFP and CFP should be defined centrally */ #ifndef _IFP #define _IFP typedef int (*IFP)(); /* takes undefined arguments */ #endif I believe this is due to GCC 15 defaulting to -std=gnu23, whereas GCC 14 defaulted to -std=gnu17, and C23 is stricter about function prototypes than C17. I'm not sure exactly what the chapter-and-verse here is in terms of the C standard, but the UX here is poor. Ideas for improvement: - tell the user how many arguments were expected vs how many were used - if we have a field of callback type, show the decl of the field - if it's a typedef, show the typedef - show where the surplus arguments begin at the callsite, and their types - special-case for the migration-to-C23 case?