Home | History | Annotate | Download | only in stmt.switch
      1 // RUN: %clang_cc1 -std=c++11 %s -verify
      2 // expected-no-diagnostics
      3 
      4 struct Value {
      5   constexpr Value(int n) : n(n) {}
      6   constexpr operator short() const { return n; }
      7   int n;
      8 };
      9 enum E { E0, E1 };
     10 struct Alt {
     11   constexpr operator E() const { return E0; }
     12 };
     13 
     14 constexpr short s = Alt();
     15 
     16 void 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 the
     35     // enumeration.
     36     case Value(2):
     37     case 3:
     38       break;
     39   }
     40 }
     41