https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57170
--- Comment #7 from Eric Gallager <egallager at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #6) > It should be an error, not a warning. For other narrowing conversions > involving constants we do actually use -Wnarrowing (but still defaulting to > an error) so I guess my last comment was wrong. > > Or it could just be an unconditional error. Or a permerror, so -fpermissive > would allow it. I'd prefer the permerror so -fpermissive would allow it, but... > > The code that handles this is in gcc/c-family/c-common.c so isn't > C++-specific. I'm not sure if that code has enough context to know if the > conversion happens in a constant expression where narrowing conversions are > disallowed. ...if it's in c-common.c... are permerrors allowed to come from there even though -fpermissive is only for C++? > > > #0 unsafe_conversion_p (loc=<optimized out>, loc@entry=267203, > type=type@entry=0x7ffff013c690, expr=expr@entry=0x7ffff01401f8, > result=result@entry=0x7ffff0140048, produce_warns=produce_warns@entry=true) > at /home/jwakely/src/gcc/gcc/gcc/c-family/c-common.c:1261 > #1 0x00000000008cdb27 in conversion_warning (loc=267203, > type=type@entry=0x7ffff013c690, expr=expr@entry=0x7ffff01401f8, > result=result@entry=0x7ffff0140048) at > /home/jwakely/src/gcc/gcc/gcc/c-family/c-warn.c:1127 > #2 0x00000000008d11d1 in warnings_for_convert_and_check (loc=<optimized > out>, loc@entry=267203, type=type@entry=0x7ffff013c690, > expr=expr@entry=0x7ffff01401f8, result=result@entry=0x7ffff0140048) at > /home/jwakely/src/gcc/gcc/gcc/c-family/c-warn.c:1278 > #3 0x000000000085df41 in convert_and_check (loc=loc@entry=267203, > type=type@entry=0x7ffff013c690, expr=0x7ffff01401f8) at > /home/jwakely/src/gcc/gcc/gcc/c-family/c-common.c:1548 > #4 0x0000000000886a55 in c_add_case_label (loc=loc@entry=267203, > cases=0x24ad5e0, cond=cond@entry=0x7ffff7ff6cf0, > orig_type=orig_type@entry=0x7ffff013c690, low_value=<optimized out>, > low_value@entry=0x7ffff01401f8, high_value=<optimized out>, > high_value@entry=0x0, outside_range_p=0x24abff0) > at /home/jwakely/src/gcc/gcc/gcc/c-family/c-common.c:4780 > #5 0x000000000066b1fa in finish_case_label (loc=267203, > low_value=<optimized out>, low_value@entry=0x7ffff01401f8, > high_value=<optimized out>) at /home/jwakely/src/gcc/gcc/gcc/cp/decl.c:3669 > #6 0x00000000007309e9 in cp_parser_label_for_labeled_statement > (parser=parser@entry=0x7ffff7ff6ab0, attributes=attributes@entry=0x0) at > /home/jwakely/src/gcc/gcc/gcc/cp/parser.c:11072