[clang] [Clang][Sema] Refactor collection of multi-level template argument lists (PR #106585)
Krystian Stasiowski via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 23 09:49:32 PDT 2024
sdkrystian wrote:
I've manually reduced the standalone reproducer to the following:
```cpp
template<int N>
struct A
{
template<typename T>
static constexpr bool f();
};
template<>
template<typename T>
constexpr bool A<0>::f()
{
return A<1>::f<T>();
}
template<>
template<typename T>
constexpr bool A<1>::f()
{
return true;
}
template<int N>
constexpr bool g()
{
return A<N>::template f<int>(); // note: undefined function 'f<int>' cannot be used in a constant expression
}
template bool g<0>();
static_assert(g<1>()); // error: static assertion expression is not an integral constant expression
```
The error does not occur if the explicit instantiation definition (i.e. `template bool g<0>()`) is removed. I'm looking into it.
https://github.com/llvm/llvm-project/pull/106585
More information about the cfe-commits
mailing list