/* I expected this to print: 0, 1, 2, default
   It doesn't.
   GCC used to treat this an error, but 7.3.0 quietly compiles it
   and sits back to enjoy watching you try to figure it out.
   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7508 */

#pragma GCC push_options
#pragma GCC diagnostic error "-Werror -Wall -Waddress -Warray-bounds=1 -Wbool-compare -Wbool-operation -Wc++11-compat -Wc++14-compat -Wcatch-value -Wchar-subscripts -Wcomment -Wduplicate-decl-specifier -Wenum-compare  -Wformat -Wint-in-bool-context -Wimplicit -Wimplicit-int -Wimplicit-function-declaration -Winit-self -Wlogical-not-parentheses -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces -Wmultistatement-macros -Wnarrowing -Wnonnull -Wnonnull-compare -Wopenmp-simd -Wparentheses -Wpointer-sign -Wreorder -Wrestrict -Wreturn-type -Wsequence-point -Wsign-compare -Wsizeof-pointer-div -Wsizeof-pointer-memaccess -Wstrict-aliasing -Wstrict-overflow=1 -Wstringop-truncation -Wswitch -Wtautological-compare -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunused-function -Wunused-label -Wunused-value -Wunused-variable -Wvolatile-register-var"

void setup() {
  Serial.begin(115200);
}


void thatsodd(int a) {
  switch (a) {
    case 0:
      int b = a;  // comment out this line and it will work
      Serial.println(0);
      break;
    case 1:
      Serial.println(1);
      break;
    case 2:
      Serial.println(2);
      break;
    default:
      Serial.println("default");
      break;
  }
}

void loop() {
  Serial.print("GCC version: ");
  Serial.print(__GNUC__); Serial.print(".");
  Serial.print(__GNUC_MINOR__); Serial.print(".");
  Serial.println(__GNUC_PATCHLEVEL__);
  Serial.println("Begin");
  thatsodd(0);
  thatsodd(1);
  thatsodd(2);
  thatsodd(255);
  Serial.println("End");
  while (1);
}

#pragma GCC pop_options