xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/gnu-case-ranges.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -verify -Wno-covered-switch-default %s
2*f4a2713aSLionel Sambuc // expected-no-diagnostics
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc enum E {
5*f4a2713aSLionel Sambuc     one,
6*f4a2713aSLionel Sambuc     two,
7*f4a2713aSLionel Sambuc     three,
8*f4a2713aSLionel Sambuc     four
9*f4a2713aSLionel Sambuc };
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc 
test(enum E e)12*f4a2713aSLionel Sambuc int test(enum E e)
13*f4a2713aSLionel Sambuc {
14*f4a2713aSLionel Sambuc     switch (e)
15*f4a2713aSLionel Sambuc     {
16*f4a2713aSLionel Sambuc         case one:
17*f4a2713aSLionel Sambuc             return 7;
18*f4a2713aSLionel Sambuc         case two ... two + 1:
19*f4a2713aSLionel Sambuc             return 42;
20*f4a2713aSLionel Sambuc         case four:
21*f4a2713aSLionel Sambuc             return 25;
22*f4a2713aSLionel Sambuc         default:
23*f4a2713aSLionel Sambuc             return 0;
24*f4a2713aSLionel Sambuc     }
25*f4a2713aSLionel Sambuc }
26