brintos

brintos / llvm-project-archived public Read only

0
0
Text · 702 B · fda0c5c Raw
41 lines · cpp
1// RUN: %clang_cc1 -std=c++11 %s -verify2// expected-no-diagnostics3 4struct Value {5  constexpr Value(int n) : n(n) {}6  constexpr operator short() const { return n; }7  int n;8};9enum E { E0, E1 };10struct Alt {11  constexpr operator E() const { return E0; }12};13 14constexpr short s = Alt();15 16void test(Value v) {17  switch (v) {18    case Alt():19    case E1:20    case Value(2):21    case 3:22      break;23  }24  switch (Alt a = Alt()) {25    case Alt():26    case E1:27    case Value(2):28    case 3:29      break;30  }31  switch (E0) {32    case Alt():33    case E1:34    // FIXME: These should produce a warning that 2 and 3 are not values of the35    // enumeration.36    case Value(2):37    case 3:38      break;39  }40}41