<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/110321>110321</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang++-18] Unexpected `deprecated-declarations` warning, when this warning is explicitly suppressed
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ralfkonrad
</td>
</tr>
</table>
<pre>
`clang-18` shows an unexpected `deprecated-declarations` warning when a deprecated constructor is used in `std::make_shared<T>(args from deprecated constructor...)` while the warning is turned of using `_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")`.
On the other hand using `std::shared_ptr<T>(new T(args from deprecated constructor...))` does not emit any warning as expected when it off.
Neiter `clang-16` and `clang-17` nor `gcc` on `ubuntu-24.04` and `msvc` emit a warning.
The same behaviour can be seen with `boost::shared_ptr` instead of `std::shahred_ptr`.
To reproduce this issue, see https://github.com/ralfkonrad/clang_deprecation_warning and its [workflow results](https://github.com/ralfkonrad/clang_deprecation_warning/actions).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVEFv8zYM_TXyhYghy7EdH3xom-W47dBhx0CRGFurLRmi1Hz994OUfMnXDR02DAhiWCb53uMTKYnMaBEH1jyzZl_IGCbnBy_n85uzXuri5PTHwFquZmnHTbVjLQea3IVAWogWv62oAmpgLde4elQyoN5oVLP0MhhnKWVcpLfGjnCZ0IKERyQoZyn4qILzYAgioQZjUzkKmtVPrH5a5BseaZIeNatfXln9ExM76UeCs3fLF8XKsmSiz9iTmRHChHcWhiBEb1GDO0OkdMRafvzVy3GRTOyYEFkuaCNH6ygYBWa0ziedzQsTYvP7V2Lz5_xL4CXje8afrv-_2MzChQk9TNLqB_Zd61XmcQ3-IdXiBV7_veSrau2QwLoAuJgA0n7c1UuCu2vZDxPAnc-fqP6MJqCHh-9tqpkoP466dGRdjhqVSm8uGxdP0Ya4EduSb39IW-g9B10JfafzCfZ1QiC5IJxwku_GRQ9KWjghEKKFiwlTqnRyjsLf-tVyMJYCymzrX5o6PaI-IzrwuHqno0p3xBAYoohMvCRImEJYKRURByYOowlTPJXKLUwcHjPCxCG35PjdFuPs8d5tq8EEAtY8X5x_O8_uAh4pzoFYs2di978hmDhIdb18or-JK_RQ677uZYFD1Ylu27Z93RTTIHTbYNPv6nbX6k70qlK8a5tdhVXX8V4WZhBcbHkvuqpvmrop-Vn2sjq3VYdbVfGebTku0szlPL8vpfNjkTs2VBWvRVXM8oQz5X1ym6I0DM2-8ENK2JziSGzLZ0OBHiWCCXNeQreMZyae07Jp9vDbf9wxybp8rbObP4w8fltno0yYP4DiunokQl1EPw__YEFieHtsVu_-QBWYOGTFxMThJvp9EH8GAAD__1J2uNE">