llvm-project
llvm-project copied to clipboard
[Clang] Variable template partial specialization cannot specialize primary template with `auto` NTTP
Reproducer:
template <auto> constexpr bool b = false;
template <int I> constexpr bool b<I> = true;
Error:
<source>:2:33: error: variable template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list
2 | template <int I> constexpr bool b<I> = true;
| ^~~~
Possibly related: #42421.
See Compiler Explorer: https://godbolt.org/z/nEdbcKqWs
@llvm/issue-subscribers-clang-frontend
Author: None (MagentaTreehouse)
Reproducer:
```c++
template <auto> constexpr bool b = false;
template <int I> constexpr bool b<I> = true;
```
Error:
<source>:2:33: error: variable template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list
2 | template <int I> constexpr bool b<I> = true;
| ^~~~
Possibly related: #42421.
See Compiler Explorer: https://godbolt.org/z/nEdbcKqWs
edg also agrees w/ gcc/MSVS: https://godbolt.org/z/MqE54KnfM
This is a bug. The equivalent class template partial specialization case does work with Clang.