<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, May 11, 2015 at 4:23 AM, Dennis Luehring <span dir="ltr"><<a href="mailto:dl.soluz@gmx.net" target="_blank">dl.soluz@gmx.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">#define TEST0 0xFFFA0000<br>
#define TEST1 0xFFFA0001<br>
<br>
const int test0 = 0xFFFA0000;<br>
const int test1 = 0xFFFA0001;<br>
<br>
int main(int argc, char** arcv)<br>
{<br>
  if(argc == TEST0) // OK<br>
  {<br>
    return 1;<br>
  }<br>
<br>
  if(argc == test0) // OK<br>
  {<br>
    return 1;<br>
  }<br>
<br>
  switch(argc)<br>
  {<br>
    case TEST1: return 2; // ERROR: case value evaluates to 4294574081, which cannot be narrowed to type 'int' [-Wc++11-narrowing]<br>
  }<br>
<br>
  switch(argc)<br>
  {<br>
    case test1: return 2; // OK<br>
  }<br>
}<br></blockquote><div><br></div><div>This isn't really the right list for this, but...</div><div><br></div><div>In the `if` statements, integral promotions apply, and the resulting type can be other than `int`.  In the switch, the case labels must be converted to match the type of the initial `switch` expression (here, `int`) -- and the narrowing conversion from a constant is not permitted there.</div><div><br></div><div>-- James</div></div></div></div>