PR c++/68362
* c-common.c (check_case_bounds): Fold low and high cases.
* g++.dg/delayedfold/switch-1.C: New test.
From-SVN: r230435
+2015-11-16 Marek Polacek <polacek@redhat.com>
+
+ PR c++/68362
+ * c-common.c (check_case_bounds): Fold low and high cases.
+
2015-11-16 Marek Polacek <polacek@redhat.com>
* c-ada-spec.c (dump_ada_template): Use RECORD_OR_UNION_TYPE_P.
min_value = TYPE_MIN_VALUE (orig_type);
max_value = TYPE_MAX_VALUE (orig_type);
+ /* We'll really need integer constants here. */
+ case_low = fold (case_low);
+ case_high = fold (case_high);
+
/* Case label is less than minimum for type. */
if (tree_int_cst_compare (case_low, min_value) < 0
&& tree_int_cst_compare (case_high, min_value) < 0)
+2015-11-16 Marek Polacek <polacek@redhat.com>
+
+ PR c++/68362
+ * g++.dg/delayedfold/switch-1.C: New test.
+
2015-11-16 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/58027
--- /dev/null
+// PR c++/68362
+// { dg-do compile { target c++11 } }
+
+enum class A { foo };
+enum E { bar };
+
+void
+fn1 (const A a)
+{
+ switch (a)
+ case A::foo:;
+}
+
+void
+fn2 (E e)
+{
+ switch (e)
+ case bar:;
+}