<html>
    <head>
      <base href="https://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 --- - Clang compiles a return statement with an expression in a void function (illegal under C90 6.6.6.4) with -std=c90 -pedantic"
   href="https://llvm.org/bugs/show_bug.cgi?id=27055">27055</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang compiles a return statement with an expression in a void function (illegal under C90 6.6.6.4) with -std=c90 -pedantic
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.8
          </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>Keywords</th>
          <td>accepts-invalid
          </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>ryao@gentoo.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16082" name="attach_16082" title="Test case where Clang allows a void function to return an expression">attachment 16082</a> <a href="attachment.cgi?id=16082&action=edit" title="Test case where Clang allows a void function to return an expression">[details]</a></span>
Test case where Clang allows a void function to return an expression

ISO C90 6.6.6.4 says that "A return statement with an expression shall not
appear in a function whose return type is void."

Both Sun Studio and the TenDRA make this a build failure as the specification
requires while Clang does what GCC does. The sudo project had a bug filed
agaisnt it because of Sun Studio:

<a href="https://bugzilla.sudo.ws/show_bug.cgi?id=727">https://bugzilla.sudo.ws/show_bug.cgi?id=727</a>

Clang will only emit a warning when -pendantic is specified and adding -std=c90
does not change the behavior to a warning. The GCC documentation for -pedantic
clearly states that things disallowed by the specification emit errors:

<a href="https://gcc.gnu.org/onlinedocs/gcc-4.9.3/gcc/Warning-Options.html">https://gcc.gnu.org/onlinedocs/gcc-4.9.3/gcc/Warning-Options.html</a>

This probably should be a warning even without `-pendantic`.

This was also filed against GCC, which exhibits the same behavior:

<a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70400">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70400</a>

Also, I tested the attached minimal test case against both GCC 4.9.3 and Clang
3.8.0. kate in ##c on freenode tested against TenDRA while the reporter for the
sudo bug caught the issue in sudo with Sun Studio 12.</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>