https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71552
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Status|UNCONFIRMED |RESOLVED CC| |msebor at gcc dot gnu.org Resolution|--- |WONTFIX Severity|minor |enhancement --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- Unfortunately, C allows the implicit conversion of integers to pointers. This can be seen at local scope where GCC diagnoses the initialization with just a warning: initialization makes pointer from integer without a cast. At the same time, C doesn't consider pointers to be valid constant integer expressions and so it doesn't allow their use in initializers of static integers. GCC normally detects and issues errors before warnings, and so the submitted test case is rejected on those grounds. The error causes the internal representation of the initializer expression to be replaced with a special error node which prevents any further diagnostics. With this in mind, I don't think it's feasible to change the diagnostic. What might be possible to do is to treat pointers in initializers as constant expressions as an extension, but such a change that should be considered on its own merits rather than with the goal of (only) improving diagnostics. In light of this, I resolve this enhancement request as WontFix.