https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88695
Bug ID: 88695 Summary: Accepts invalid program with incompatible function types. Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: anders.granlund.0 at gmail dot com Target Milestone: --- Test case (prog.c): void f() { } int main() { void (*g)(int) = 0; &f == g; } Compilation command line: gcc prog.c -Wall -Wextra -std=c11 -pedantic-errors Observed behaviour: No error messages outputed. Expected behaviour: An error message outputed. The program is invalid due to the following paragraphs of the standard: 6.5.9/2: "One of the following shall hold: — both operands have arithmetic type; — both operands are pointers to qualified or unqualified versions of compatible types; — one operand is a pointer to an object type and the other is a pointer to a qualified or unqualified version of void; or — one operand is a pointer and the other is a null pointer constant." 6.7.3/15: "... If one type has a parameter type list and the other type is specified by a function definition that contains a (possibly empty) identifier list, both shall agree in the number of parameters, and the type of each prototype parameter shall be compatible with the type that results from the application of the default argument promotions to the type of the corresponding identifier. ..."