Commit 0f62c7a0 by Marek Polacek Committed by Marek Polacek

re PR c++/68362 (ICE: tree check: expected integer_cst, have nop_expr in get_val, at tree.h:5157)

	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
parent 3e6ab828
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.
* c-common.c (c_common_get_alias_set): Likewise.
(handle_visibility_attribute): Likewise.
......
......@@ -3769,6 +3769,10 @@ check_case_bounds (location_t loc, tree type, tree orig_type,
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
......
// 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:;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment