Issue |
131080
|
Summary |
`if constexpr` appears to not work correctly in some nested templates
|
Labels |
new issue
|
Assignees |
|
Reporter |
HolyBlackCat
|
I think I've seen similar tickets at some point, so this could be a duplicate.
The following code doesn't compile, but it should: https://gcc.godbolt.org/z/648eY8eh5
```cpp
template <typename T>
struct FalsePredicate
{
static constexpr bool value = false;
};
template <typename T, template <typename> typename Cond>
void foo()
{
[]<template <typename> typename Cond2 = Cond>
{
if constexpr (Cond2<T>::value)
T::foo();
}();
}
int main()
{
foo<int, FalsePredicate>();
}
```
It says that `T::foo()` is invalid for `T=int`, despite there being `if constexpr`.
Tested on Clang 20 and trunk.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs