The advice tells you not to do something, for some very specific reasons.
Then you go ahead and do it anyway.

It's like being told "jumping off a cliff will hurt". So you do it and complain "it hurts".

> If It is true then Why g++ is not supporting ??? Can You give me reason???
IMO, your code is broken and each compiler is correct in it's own way. Correct code should produce the same answer on ALL compilers.

Since the reason stated amounts to "implementation specific" or "undefined" behaviour, absolutely anything can happen.

This includes producing the answer you expect based on your preconceived ideas on what should happen. But that doesn't mean the compiler which matches your ideas is right any more than it makes compilers which differ wrong.

If you want repeatable code, you need to avoid any hint of code which falls into the
- implementation defined,
- unspecified,
- undefined
Read this for further definition of these terms.

Talking of things undefined, main returns int, not void.