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

    <tr>
        <th>Summary</th>
        <td>
            [clang] Diagnose invalid specializations of type traits
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang,
            clang:diagnostics
      </td>
    </tr>

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

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

<pre>
    The following code is ill-formed, but we don't diagnose it:

```c++
#include <type_traits>

template <>
struct std::common_type<int, int> { using type = long; }; // should warn

struct Foo { };
template <>
struct std::common_type<Foo> { using type = int; }; // should warn

template <>
struct is_integral<Foo> { }; // should warn

// etc...
```

It would be nice if Clang caught invalid specializations of `std::common_type`, and in fact perhaps of the other type trait classes as well.

Extracted from https://github.com/llvm/llvm-project/pull/99473#discussion_r1691981664.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVE1v2zAM_TXyhaghS_6IDj40SQ3svnugSIqtQZEMk27W_frBTtpmwzp0AwQLNkW-9_hEa0TfR-daVm1Ztc_0TEOa2mB9itFlx2Rf2q-Dg1MKIV187MEk68Aj-BAeTmk6O8vEDo4zwcWBTZGJhsB63ceEDjwx-cj4nvHXZ82vyzCxXdb1q5A-mjBbB0zu6GV0B5q0J2Ty6T6b3HkMmtZTbyGkaTYESHbBko8mnc8pHpYqTO58pIXgssknYM0WZlx0LGFgcg8hxZ7JLbBmv26iY6IDHNIcLFz0FO8J3LC6lNZS15z_5tal9AGple4nOf0N2OPBR3L9pMOveJ-qfIs6Mnme_-bf_bkvBJe1wNFB9MaBP8Eu6OW26LkfCHx81sFbwNEZr4P_ocmniJBOwGr-x-7UfLFNRws-wkkbgtFNgx7XJBocJBrcdO3YelfABI3oEDTCxYWQ3zN8-k6TNuQsnKZ0hoFoxAVzFdh7GuZjbtKZiS6E59ftYZzSN2eIiW6cQ2CiU6psJBPSejQzok_xMBW1KtSmqOvyhpjZVlollc5cWzRCVGKzUSobWmcaJSujDFfcNrZptFKq0HV1bKpKqDrzreCi5BteFHVRVpu8EMYVpamUlZyfdMlK7s7ah3yhl6epzzzi7NqCFxVXWdBHF3CdZSHMYgATgond25t8vE0meYNLrNpnU7tqPc49spIHj4Tv5clTWH8O1_xqD_u30f7Y03dTMJun0P5zu1dVyER3E_bcip8BAAD__-Rjb0c">