<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Microsoft mangling cannot mangle injected class name type"
   href="https://bugs.llvm.org/show_bug.cgi?id=36181">36181</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Microsoft mangling cannot mangle injected class name type
          </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>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>smeenai@fb.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>compnerd@compnerd.org, david.majnemer@gmail.com, dgregor@apple.com, llvm-bugs@lists.llvm.org, rnk@google.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Using the reduced test case from <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - We shouldn't try to mangle an injected class name with -fdelayed-template-parsing and -cxx-abi microsoft"
   href="show_bug.cgi?id=16887">https://bugs.llvm.org/show_bug.cgi?id=16887</a> (I
independently arrived at an almost equivalent reduced test case before finding
that one, sigh):

% cat reduced.h
template <typename T> struct A {
  friend void f(A<T>) {}
};
void g() { f(A<int>()); }

% touch empty.cpp
% clang -cc1 -triple x86_64-windows-msvc -emit-pch -o reduced.h.pch -x
c++-header reduced.h
% clang -cc1 -triple x86_64-windows-msvc -emit-llvm -include-pch reduced.h.pch
empty.cpp
Cannot mangle injected class name type.
UNREACHABLE executed

<a href="https://reviews.llvm.org/rL188536">https://reviews.llvm.org/rL188536</a> changed this from an error to an unreachable.
It should indeed be unreachable for -fdelayed-template-parsing (and running
both of the above clang invocations with -fdelayed-template-parsing doesn't
crash), but it is reachable otherwise.

This is the same underlying issue as
<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Cannot mangle injected class name type."
   href="show_bug.cgi?id=35473">https://bugs.llvm.org/show_bug.cgi?id=35473</a> and
<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Clang test Modules/odr_hash-Friend.cpp causes assertion failure "Cannot mangle injected class name type." at lib\AST\MicrosoftMangle.cpp:2478"
   href="show_bug.cgi?id=35939">https://bugs.llvm.org/show_bug.cgi?id=35939</a>. I'm reporting this separately
because this is triggered with a precompiled header vs. modules, and there's a
reduced standalone test case.</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>