| Issue |
84368
|
| Summary |
"type constraint differs in template redeclaration" for `template` Inner Class
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
geometrian
|
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)).
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs