Skip to content
Snippets Groups Projects
Commit 0f85ae65 authored by Marek Polacek's avatar Marek Polacek
Browse files

c: ICE with nullptr as case expression [PR108424]

In this ICE-on-invalid, we crash on

  gcc_assert (INTEGRAL_TYPE_P (type));

in perform_integral_promotions, because a nullptr is an INTEGER_CST,
but not INTEGRAL_TYPE_P, and check_case_value is only checking the
former.  In the test I'm testing other "shall be an integral constant
expression" contexts as well.

	PR c/108424

gcc/c-family/ChangeLog:

	* c-common.cc (check_case_value): Check INTEGRAL_TYPE_P.

gcc/testsuite/ChangeLog:

	* gcc.dg/c2x-nullptr-6.c: New test.
parent 33237e93
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment