Factor out enumerator APSInt adjustment into
a helper function (AdjustAPSInt) and use that
for adjusting the high bounds of case ranges
before APSInt comparisons. Fixes
http://llvm.org/bugs/show_bug.cgi?id=8135
Some minor refacorings while I am here.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115355 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/gnu-case-ranges.cpp b/test/SemaCXX/gnu-case-ranges.cpp
new file mode 100644
index 0000000..d15cca1
--- /dev/null
+++ b/test/SemaCXX/gnu-case-ranges.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -o /dev/null -verify %s
+
+enum E {
+ one,
+ two,
+ three,
+ four
+};
+
+
+int test(enum E e)
+{
+ switch (e)
+ {
+ case one:
+ return 7;
+ case two ... two + 1:
+ return 42;
+ case four:
+ return 25;
+ default:
+ return 0;
+ }
+}