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

    <tr>
        <th>Summary</th>
        <td>
            Undeserved -Wctad-maybe-unsupported warnings on std::lock_guard, std::scoped_lock
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          N-Dekker
      </td>
    </tr>
</table>

<pre>
    The warning `-Wctad-maybe-unsupported` could certainly be helpful to avoid accidental uses of CTAD on a template that _may not intend to support class template argument deduction_  However, `std::lock_guard` and `std::scoped_lock` are actually _motivating examples_ for the introduction of the language feature with C++17. Looking at [p0091r3 - Template argument deduction for class templates (Rev. 6)](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0091r3.html), by Mike Spertus, Faisal Vali, and Richard Smith, 2016-06-24.

Example (tried using clang 16.0.0 at https://godbolt.org/z/oMW4MbY4M):

```
#include <mutex>
#include <shared_mutex>

std::shared_lock<std::shared_timed_mutex> r1;
std::shared_timed_mutex mut_;

auto lock = std::scoped_lock(mut_, r1); // Gets a "may not intend to support CTAD" warning!

```

Output:

>  warning: 'scoped_lock' may not intend to support class template argument deduction [-Wctad-maybe-unsupported]

`std::lock_guard` and `std::scoped_lock` are obviously intended to support CTAD, so the warning is undeserved in this case. Could `-Wctad-maybe-unsupported` possibly skip `std::lock_guard` and `std::scoped_lock` somehow? Or could those two templates possibly be marked "intended for CTAD"?  

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVV2v4jYQ_TXmZUSU2CQXHvLAx9I-9Hal3W1XfUKOPRAvThzZY1j66ysH9n6J20pbCZnYnsycc-w5kSGYQ49Ys3LFys1ERmqdr3-fbvB4RD9pnL7UX1qEs_S96Q_Aqnz6VZHU005eGpzGPsRhcJ5QsyoH5aLVoNCTNL29QIPQoh320QI5kCd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