http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=118357 introduced pedwarns about any static decls in external linkage inline functions, but ISO C99 6.4.7/3 has: "An inline definition of a function with external linkage shall not contain a definition of a modifiable object with static storage duration, and shall not contain a reference to an identifier with internal linkage." In -std=c99:
inline int foo (void) { static const int c = 6; return c; } the static variable c isn't modifiable, so the first condition doesn't apply, and from 6.2.2 I gather c has no linkage rather than internal linkage and so the other condition doesn't apply either. In -std=c99: static const int c = 6; inline int foo (void) { return c; } I believe c has internal linkage and thus it is invalid (and therefore correctly diagnosed by the trunk). -- Summary: [4.3 Regression] PR11377 pedwarns even about valid code Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jakub at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35017