<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - No warning for implicit conversion from an integer expression with integer constants to char"
   href="http://llvm.org/bugs/show_bug.cgi?id=18585">18585</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>No warning for implicit conversion from an integer expression with integer constants to char
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>chengniansun@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Clang does not warn implicit conversions from integer expressions to smaller
types, such as char.

For the following example, Clang should warn the conversion from the expression
"c + 1" of integer type to "char", also for the "c += 1".

$: cat s.c 
static char a(char c) {
  c = c + 1;
  c += 1;
  return c;
}
$: clang-trunk -c -Wconversion s.c 
$: clang-trunk --version
clang version 3.5 (trunk 199549)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$: gcc-trunk -c -Wconversion s.c 
s.c: In function ‘a’:
s.c:2:9: warning: conversion to ‘char’ from ‘int’ may alter its value
[-Wconversion]
   c = c + 1;
         ^
s.c:3:5: warning: conversion to ‘char’ from ‘int’ may alter its value
[-Wconversion]
   c += 1;
     ^</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>