<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 --- - injected-class-name should not be modelled as a CXXRecordDecl"
   href="https://llvm.org/bugs/show_bug.cgi?id=27532">27532</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>injected-class-name should not be modelled as a CXXRecordDecl
          </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>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>richard-llvm@metafoo.co.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>We currently model an injected-class-name declaration as a CXXRecordDecl. This
leads to a number of problems and violations of our usual AST invariants. For
instance:

 * the redecl chain of a ClassTemplateSpecializationDecl contains declarations
that are not ClassTemplateSpecializationDecls, and getPreviousDecl sometimes
(!!!) skips over them (depending on the static type of the object expression)

 * not all declarations of the same entity are guaranteed to have the same
semantic DeclContext

 * we waste memory on a DeclContext that can never have any children or lookups

... and so on.

Given that most lookups that find the injected-class-name are actually required
to find the constructors rather than the type, this is an especially poor
representation.

We should use a different kind of Decl here (InjectedClassNameDecl?) and update
the (relatively small) number of places that really want to map from the
injected-class-name to the class type to do so manually.</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>