Issue |
130992
|
Summary |
[Clang] 20.1.0 fails to compile variadic partial template specialization
|
Labels |
clang
|
Assignees |
|
Reporter |
juchem
|
The following minimum repro used to compile successfully and work correctly with Clang 19.1.4, but fails to compile with Clang 20.1.0:
```
#include <iostream>
#include <utility>
template <typename> struct s;
template <typename T> constexpr std::size_t size = s<T>::value;
// list
template <template <typename...> typename L, typename... U>
struct s<L<U...>> { static constexpr std::size_t value = sizeof...(U); };
// sequence
template <typename T, template <typename, T...> typename L, T... U>
struct s<L<T, U...>> { static constexpr std::size_t value = sizeof...(U); };
#define TEST(N) \
std::cout << "[" #N "]: " << size<std::make_index_sequence<N>> << std::endl;
int main() {
TEST(0); TEST(1); TEST(2);
TEST(3); TEST(4); TEST(5);
}
```
Compiler output in Clang 20.1.0:
```
$ clang++ -Wall -std=c++23 sz.cpp -o sz
../sz.cpp:5:52: error: implicit instantiation of undefined template 's<std::integer_sequence<unsigned long>>'
5 | template <typename T> constexpr std::size_t size = s<T>::value;
| ^
../sz.cpp:17:3: note: in instantiation of variable template specialization 'size<std::integer_sequence<unsigned long>>' requested here
17 | TEST(0);
| ^
../sz.cpp:14:32: note: expanded from macro 'TEST'
14 | std::cout << "[" #N "]: " << size<std::make_index_sequence<N>> << std::endl;
| ^
../sz.cpp:4:28: note: template is declared here
4 | template <typename> struct s;
| ^
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs