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

    <tr>
        <th>Summary</th>
        <td>
            [PAC] Implicit casts results in no resigns in some cases
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            bug,
            backend:AArch64,
            clang:frontend
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          asl
      </td>
    </tr>
</table>

<pre>
    Consider the following code:
```c++
struct C {
  void fn() noexcept;
};

static void call(C& c, void (C::*f)()) {
 (c.*f)();
}

static void callNE(C& c, void (C::*f)() noexcept) {
 (c.*f)();
}

void ref() {
  C c;
  call(c, &C::fn); // <= implicit cast removes noexcept
  callNE(c, &C::fn);
}
```

It produced the LLVM IR as follows:
```llvm
 call void ptrauth (ptr @_ZN1C2fnEv, i32 0, i64 62113)(ptr noundef nonnull align 1 dereferenceable(1) %1) [ "ptrauth"(i32 0, i64 9607) ]
  call void ptrauth (ptr @_ZN1C2fnEv, i32 0, i64 62113)(ptr noundef nonnull align 1 dereferenceable(1) %1) #3 [ "ptrauth"(i32 0, i64 62113) ]
```

Note that in the first case we authenticate function pointer with wrong discriminator, no resign is inserted.

This looks similar to https://cplusplus.github.io/CWG/issues/2486.html, though I do not know what is the status of this DR in clang.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVMuO4zYQ_Br60lhDar0POnjldTDAZhAsggTIJaCplsQMTQokZSd_H5DSjD15I5cFaIimqK7qqiK5c3LURC0rPrLiuOOLn4xtuVO7s-l_azujnezJgp8IBqOUuUk9gjA9sezAkiNLDqxM1iEYfgwjrjpvF-GhA1ZtKwBXI3sYNMOaYQPa0K-CZs-ybQOrjvf5VoR7KdbvBFeKYd0xLEEw7NbVuJIdwsDDwLBZi4f6d2CGtdi_f_-I-Q-Az5_-M-S9n_-JHYtbGrZyD7p1IN4-glchIiGG5cYlyBpKA8MTwxOwrGPZEeRlVlJID4I7D5Yu5kruTvWhZGz1b4r-ke-r44_0nzzM1vSLoD6m5fPnH76Fpy_A3RYc9-fEKHW9bBwChVXf2dsQw6Dc7C2wPPn5p-e0w0F_ugZ6MkNI4qTMocQ0zVZpw2ZtFt3TANpovSgFXMlRQwo9WRrIkhbEz4oY1mnUGIv1WQTdcENmiAzrdzBNmVTrxuOjZl-PMGbZv7N-xbrT_kvnno0n8BP3IPV60KV1MTEEN4JQnLSXgnuCYdHCS6NhNlJ7snCTfoKbNXqEXjph5UVq7o0NHLQBS-GCAelAakfWU79_hP5-kg6UMS8OnLxIxS14A5P3c0xLjLKY1eLCbz9KPy3nvTQMT92P3zA8SecWcgxPmNflfvIXFXD9ZJZxgifoDWjj4UWbG9xigy42GI754sAM4AOB45fQuVBcj_td32Z9kzV8R21aYd4kVVXgbmpF2lDVVEU_8LLgvCZME14URdKUVdMnYidbTDBPamySIsEM9zUWRZqnGVZpndd1xfKELlyqfYj93thxF-m3aVLmdbVT_EzKxZsY8byM0dAuzLl4Id2z7HA4WDGV-dubSDmcU2u0D1sQwy1u24Dw4byMjuWJks67O6aXXsX7_rtDx4ojPD3eEC4Ytigf7LrbF_85c6GYCbdbrGrfe7Q5I8yF4Sme6vXxYbbmFxL-0aqt3WuLvwcAAP__DYDffw">