https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64926
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- No GCC is correct, the scope of the variable x is for both the true part and the false part of the if statement. You can't declare another variable with the name of x in either part though but in your case we have a single statement of if(true) {..} which means you can declare another variable of the same name in the {} part as it is an inner-scope.