#include<stdio.h> int main() { static int X = 10; { static bool X = false; printf("..."); } printf("..."); } If you compile the code above with clang 3.4 and break at the printf() statements (gdb or lldb) then p X will always show X to be 10. The same code compiled with GCC shows X to be false in the first case and 10 in the second as expected.
Looks like we're missing the lexical block for the inner range.
Same issue is true for typedef and records (struct, union, and class). I have a fix for all these cases, in both Clang and LLVM. I will upload it for review ASAP.
*** Bug 23164 has been marked as a duplicate of this bug. ***
*** Bug 44695 has been marked as a duplicate of this bug. ***
Another attempt to fix this * https://reviews.llvm.org/D113741 (backend) * https://reviews.llvm.org/D113743 (clang)