<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/115231>115231</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            arm64ec incorrect mangling instantiating C++ template
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          efriedma-quic
      </td>
    </tr>
</table>

<pre>
    ```
template <typename X> struct Wrapper {
  int GetValue(void) const;
};
struct A {
  int GetValue(void) const;
};
template<typename X> int Wrapper<X>::GetValue(void) const { return 3; }
template class Wrapper<A>;
```

clang produces `?GetValue@$$h?$Wrapper@UA@@@@QEBAHXZ`, MSVC produces `?GetValue@?$Wrapper@UA@@@@$$hQEBAHXZ`.  I guess the algorithm in llvm::getArm64ECMangledFunctionName is wrong.

CC @mstorsjo @cjacek @dpaoliello @steplong 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykk01vnDwQxz_NcBllBbYXdg8cWBKep4dUqqqmUW9eMwtOjU1tkyjfvvK-5EVVc6lkweBhfv7PH0aGoAdLVMN6B-vrTC5xdL6mg9fUT_Lq16JVtnf9cw1lfl75NeRNpGk2MhICb-PzTFZOhPfAbzBEv6iI372cZ_II1e5UgahtxP8o3kmzELDNo9M9sC0qZ0MEfn4NquuX-Ixq_glyUfqH0EQ6qwTepi3gDfDmb_SkAj3FxVvkwHeYTnlvhjIyhDfQ5gi9iHrv4OmqjLQDzt71i6KAKcu7FwUiByaAiRF4B0xcwCL_1qTcZX252TX_3_9IxazF26937UfED1Hn816JK8RPOCwUAsaRUJrBeR3HCbVFYx6nk2cDxcZPpbhpb6UdDPXdYlXUzn5OduuAT97ZYfW287ZFEPkUovPhwaVYPUhFP1PUz9IZTcYc90Ok2Tg7YNbXvN_yrcyoLiqeb7koqjIb683msF3LnLOyEKLqheoP-V6uy03BmTqU-0zXLGeiKPKS8Zyty1WpDhX1m6rYs0oKpUDkNEltVqmnlfNDpkNYqC6KNeNFZuSeTDhOCWOWnvCYBcbS0Pg6FV3tlyGAyI0OMbxioo6GapnMIYXaKuc9qYhT8knbAbUNUdqoZUxPLbAdsB1efqls8aYeY5xDMpp1wLpBx3HZr5SbgHXHT3C6Xc3ePZCKwLqjugCsO8t_rNnvAAAA___fRC8m">