| Issue |
173160
|
| Summary |
clang on windows only: "cannot mangle this template specialization type yet"
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
Klaim
|
Minimal repro-case: https://github.com/Klaim/reprocase-clang-mangle
Given the following source file:
```c++
template< typename TypeList, typename Func >
auto for_each_type( Func func )
{
return func;
}
template< class T >
struct X {};
template< class T >
concept Component = requires(T component)
{
for_each_type<typename T::required_type>( []{} );
};
struct EntityRegistry
{
template< Component C >
auto get_component(const int id) -> X<C>
{
return {};
}
};
struct A
{
struct required_type {};
};
int main()
{
EntityRegistry entities;
entities.get_component<A>(0);
}
```
Using Windows install of llvm:
```
$ clang++ --version
clang version 21.1.7
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
$ clang++ -std=c++2a main.cxx
main.cxx:19:5: error: cannot mangle this template specialization type yet
19 | auto get_component(const int id) -> X<C>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 | {
| ~
21 | return {};
| ~~~~~~~~~~
22 | }
| ~
main.cxx:19:5: error: cannot mangle this template specialization type yet
19 | auto get_component(const int id) -> X<C>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 | {
| ~
21 | return {};
| ~~~~~~~~~~
22 | }
| ~
2 errors generated.
```
Initially reproduced with clang `v21.1.7` but the error is the same with `v21.1.8`.
However:
- On [compiler explorer, which provides clang `v21.1.0` it succeeds](https://godbolt.org/z/4sro5j3hE) (same with current `trunk`) as expected;
- On Linux/Fedora with clang `v21.1.7` it succeeds as expected;
- msvc compiles it as expected;
Notes:
- removing the template parmaters of `X` will make this code compile as expected;
- rewriting `Component` this way will make this code compile as expected:
```c++
template< class T >
concept Component = requires(T component)
{
// for_each_type<typename T::required_type>( []{} );
typename T::required_type;
};
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs