<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/84368>84368</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
"type constraint differs in template redeclaration" for `template` Inner Class
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
geometrian
</td>
</tr>
</table>
<pre>
Consider the following semi-minimal example:
```cpp
template<class T> concept IsOk = requires() { typename T::Float; };
template<IsOk T> struct Thing;
template<IsOk T> struct Foobar {
template<int> struct Inner {
template<IsOk T2> friend struct Thing;
};
};
struct MyType { using Float=float; };
Foobar<MyType>::Inner<0> foobar;
```
GCC and MSVC compile this happily, but Clang outputs (I believe erroneously):
```text
<source>:7:12: error: type constraint differs in template redeclaration
7 | template<IsOk T2> friend struct Thing;
| ^
<source>:12:26: note: in instantiation of template class 'Foobar<MyType>::Inner<0>' requested here
12 | Foobar<MyType>::Inner<0> foobar;
| ^
<source>:3:10: note: previous template declaration is here
3 | template<IsOk T> struct Thing;
| ^
```
---
I note the similarity to:
- [Defining constrained member function out of line is rejected #47364](https://github.com/llvm/llvm-project/issues/47364)
( See also [bugzilla](https://bugs.llvm.org/show_bug.cgi?id=48020), [StackOverflow 1](https://stackoverflow.com/questions/64780598/why-isnt-this-class-specialization-using-a-concept-accepted), [StackOverflow 2](https://stackoverflow.com/questions/64601583/gcc-clang-disagree-on-constrained-partial-template-specialization-with-out-of-li), and [duplicate](https://github.com/llvm/llvm-project/issues/47364). )
However, this bug is still present in trunk ([tested version](https://github.com/llvm/llvm-project/commit/b84f3ea9963058cdd910f5106ca2a70c1bb9e460)).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVkuTmzgQ_jXypQsXSDwPPvgR784hlUNSe90S0IA2QmIlMY7z67ckmBnPxKlKppZyGYz78X3dXzdwa0WvEHckO5DstOGzG7TZ9ahHdEZwtal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