1// RUN: %clangxx -fsanitize=enum %s -O3 -o %t && %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-PLAIN
2// RUN: %clangxx -fsanitize=enum -std=c++11 -DE="class E" %s -O3 -o %t && %run %t
3// RUN: %clangxx -fsanitize=enum -std=c++11 -DE="class E : bool" %s -O3 -o %t && %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-BOOL
4
5enum E { a = 1 } e;
6#undef E
7
8int main(int argc, char **argv) {
9  // memset(&e, 0xff, sizeof(e));
10  for (unsigned char *p = (unsigned char*)&e; p != (unsigned char*)(&e + 1); ++p)
11    *p = 0xff;
12
13  // CHECK-PLAIN: error: load of value 4294967295, which is not a valid value for type 'enum E'
14  // FIXME: Support marshalling and display of enum class values.
15  // CHECK-BOOL: error: load of value <unknown>, which is not a valid value for type 'enum E'
16  return (int)e != -1;
17}
18