https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64926
Bug ID: 64926 Summary: Variable declared in if-statement-header is in wrong scope Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: humbug at deeptown dot org A friend of mine (Dmitry Kashitsyn) found a bug: #include <cstdio> int main() { if (int* x=NULL) // <<< declare 'x' {} else if(true) { std::printf("%d\n", *x); // <<< You may access 'x' inside this scope } return 0; }