https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99577
Bug ID: 99577 Summary: Non-constant (but actually constant) initializers referencing other constants no longer diagnosed as of GCC 8 Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: harald at gigawatt dot nl Target Milestone: --- GCC 8 and newer no longer issue an error for const int i = 0; const int j = i; Up until GCC 7, this resulted in test.c:2:15: error: initializer element is not constant const int j = i; ^ As in the similar (and perhaps related?) bug #66618, the standard does not require a diagnostic for this code, but this code is not portable, it gets rejected by some other compilers, so an option in GCC to diagnose this would be useful. This bug is the opposite of bug #53091, which asks for this to be accepted and was never updated after GCC started to accept it. As noted in that bug, clang accepts this as well without any diagnostic. I will report it as an issue to them too, if it has not been reported already.