0

How does the compiler interpret the following code:

int a = a;

without any previously defined variable named a? Why doesn't the compiler report error here?

Jeff
  • 451
  • 3
  • 8
  • Turn on your compiler warnings and you'll probably get something. I don't know offhand whether Clang has a specific warning for this, but GCC and MSVC both warn with blanket options. – chris Sep 20 '19 at 04:30
  • See https://timsong-cpp.github.io/cppwp/n3337/basic.scope.pdecl#1. – R Sahu Sep 20 '19 at 04:36

0 Answers0