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

    <tr>
        <th>Summary</th>
        <td>
            c++ concepts: "type constraint differs in template redeclaration"
        </td>
    </tr>

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

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

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

<pre>
    This is reproducible in both clang++17 and clang++18.
This used to work with clang++16.
(I verified using godbolt.)

I get this error:
```
<source>:10:18: error: type constraint differs in template redeclaration
   10 | template<sender>
      |                  ^
<source>:15:30: note: in instantiation of template class 'some_template<int>::bar<int>' requested here
   15 | some_template<int>::bar<int> b;
      | ^
<source>:3:10: note: previous template declaration is here
 3 | template<sender>
      |          ^
1 error generated.
Compiler returned: 1
```

When compiling this code with clang++17:
```
template<typename> concept sender = true;

template<sender>
class foo;

template<typename X>  // <-- remove this and compiler is happy.
struct some_template {
 template<typename>  // <-- Or remove this and compiler is happy.
    class bar {
        template<sender>
        friend class ::foo;
 };
};

some_template<int>::bar<int> b;
```

The compiler is no longer unhappy, if I turn either `some_template` or `bar` into not-a-template (marked in the code).
Similarly if I use `typename` instead of a concept, the compiler is happy too.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVV2PqzYQ_TXOyygR2CSQBx6y2Rtpn_rQK7VvlcEDuBdsOja72v76yoZ87Ye6iyInMZ4554zP2NI53RrEkm0f2PZxJSffWSqN7Ej6f2W3qqx6LX922oF2QDiSVVOtqx5BG6is76DupWkZf2D8Ic1BGnU3U2xY8siSQ0wxOVTgLbxY-gUv-k3wblnKePEEz0i60ahgctq00FpV2d5vGN8vi-L4BC168CE3ElliYnnBdsnymf-Ko7MT1cjEDyYOaRKGgonDJQz864hQW-M8SW08KN00SC7I9DiMvfQIhArrXpL02po5MwCkCbD8eFkVsNAopIB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