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

    <tr>
        <th>Summary</th>
        <td>
            Clang ignores a constraint in a partial specialization of a class template
        </td>
    </tr>

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

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

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

<pre>
    I'm trying to create a specialization of the `Foo` class template that only accepts specializations of the `Bar` class template as a template argument. However, clang ignores my `IsBar<T>` constraint and accepts `int` as a template argument.
```cpp
template<typename>
struct Foo;

template<typename>
struct Bar {};

template<typename T>
concept IsBar = requires (T t) { [] <typename U> (Bar<U>& c) {} (t); };

template<IsBar T>
struct Foo<T> {
    static void test() {}
};

int main() {
    Foo<Bar<int>>::test(); // OK

    // static_assert(!IsBar<int>);

    // the following line compiles
    // unless i uncomment the static_assert:
    Foo<int>::test(); // this should not compile
}
```
`static_assert`'ing `!IsBar<int>` seems to make it correctly reject `int`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNVE1v2zAM_TXyhVhgy7WdHHxomhUbdtglOw-yzcbaZMmT5BbZrx8l57vttkJoJJN875Ei1ZhuX39mvBrA273UO_AGWovCIwhwI7ZSKPlbeGk0mCfwPQIr00dj6D-0SjgHHodRhQDfCw9Gqz2ItsXRuxsAd4GwFvYNBOGI9Xyyu2lA7RfwybzgM1rGH0IEqZQ7bSw6GPYB7LMLcPnDluUfIypxeSuk9iB0d1JDJvoUHN7hYemGpffkMK92HOcvR0-i8PsRtRgwMEUbEU2th1CRfH0A-N8gUg2sWrNq8-9Y2J6iKb2QEMS0geUbsPhrkqEejC-34BlfBVxgxZoVG7hE-UYowWsuWDgxXkJ7iCAlwRgASBH8VdjMvn2zEPEmImA0Af05Tz3QwrORHVXeEcXyTHqgeEUXbnCge7xwPgHORHMe4VpJR1j3tM74MQv-SAu-frlEDggHw6zsOzUi2jksOzbUATfivBMd-vnJKGVewvQoqZHabxilQvfKd9L01YGkDfmElovh1wLy-9scj9m9m5rvJc1abybVgTb-KOBc1eu-Ph2vicnAq5BE3N3WgKbGIQ4uPBCD-IkgA4-12HoaeIs_aHOesATrrCzLvLorC550dd6t8pVIvPQK64erERaX4yo1nUdhPb0abzw_4ubBSCar6t770YXqxGLspO-nZkEloINSz8efD6M1QSMdpXMT3Q5_LJZFfpf0dZNjk4um5JXAZoltVvJilT5lq6ZpRZtViRINKleHeeJc4wtECNrTeCWy5innWcqzrCrSgi_aJiuqatXlzbJqOuzYXYrUxWoRdCyM3SW2jpKaaefIqKTz7mykBKk2iPU8vomYfG9svRFa83yVROo6Sv8DFl69fw">