<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 --- - "typedef requires a name" should not always be an error with -pedantic-errors"
   href="http://llvm.org/bugs/show_bug.cgi?id=22249">22249</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>"typedef requires a name" should not always be an error with -pedantic-errors
          </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>Windows NT
          </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>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>harald@gigawatt.nl
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Compiling

  typedef struct S { };

with -pedantic-errors gives

test.cc:1:1: error: typedef requires a name [-Werror,-Wmissing-declarations]
typedef struct S { };
^~~~~~~
1 error generated.

This should remain a warning. There is no rule in C++ (C++11, anyway) anywhere
disallowing this, and GCC does accept it when compiling with -pedantic-errors.

Note:

  typedef struct { };

gives the exact same error message, but clang is right to reject this (as is
GCC). This violates [dcl.dcl]p5: "In such cases, the decl-specifier-seq shall
introduce one or more names into the program, or shall redeclare a name
introduced by a previous declaration" with or without the typedef keyword.</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>