<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 --- - Assertion failed: !isa<TagDecl>(this) || !cast<TagDecl>(this)->isCompleteDefinition()"
   href="https://llvm.org/bugs/show_bug.cgi?id=28508">28508</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion failed: !isa<TagDecl>(this) || !cast<TagDecl>(this)->isCompleteDefinition()
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.8
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </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>jtony@ca.ibm.com
          </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>This problem only happens when I try to compile the test case as a c file using
clang, if I compile it as a c++ file using clang++, there is no assertion.

Steps to reproduce on linux:
-bash-4.2$ cat r.c
int main()
{
  typedef char* CHARPT;
  for (struct CHARPT {int i;} a;;) {}
  return 55;
}

-bash-4.2$ clang  r.c
r.c:4:15: error: declaration of non-local variable in 'for' loop
  for (struct CHARPT {int i;} a;;) {}
              ^
clang: /home/jtony/build/3_8/llvm-dev.src/tools/clang/lib/AST/DeclBase.cpp:113:
void clang::Decl::setInvalidDecl(bool): Assertion `!isa<TagDecl>(this) ||
!cast<TagDecl>(this)->isCompleteDefinition()' failed.
...
1.      r.c:5:3: current parser token 'return'
2.      r.c:2:1: parsing function body 'main'
3.      r.c:2:1: in compound statement ('{}')
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.8.0 (tags/RELEASE_380/final)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/jtony/build/runnable/bin</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>