Your question seems to be based on the incorrect premise that C Standard somehow "allows you to compile this code." In fact, C Standard does not have such a concept as "permission or inability to compile code."
If the code is invalid, the Standard requires compilers to inform you of this with diagnostic messages. The standard does not require compilers to refuse to compile your code. They can still progress and compile it in a certain way.
Your code is clearly invalid according to the C standard. The standard C language does not allow implicit conversion of integers to a pointer. And your compiler clearly told you about this through diagnostic messages. This is enough to ensure that the compiler complies with the requirements of the standard.
After that, all bets are disabled. Your compiler can compile it into "something", but it is not a corresponding C program. Its behavior is not determined by the language.
As for the format of the received diagnostic messages (and whether they are “warnings” or “errors”), this is a question for your compiler. In C, this is a quality implementation problem. C Standard has nothing to do with it.
You can ask clang to report violations of the C language restrictions as "errors" by specifying the -pedantic-errors flag. This is not ideal for this purpose, but it will cause the compiler to refuse to compile your code (if you need it).
source share