Issue |
84020
|
Summary |
Compiler error for delayed template in
|
Labels |
new issue
|
Assignees |
|
Reporter |
rath3t
|
The following code fails to compile with clang trunk and clang 16 (See godbolt link).
The templated member function is not found by clang and therefore the `static_assert` is triggered.
The struct `A` inherits from `T` and therefore the base class member function `foo` exists, thus the `static_assert` should not trigger.
It works for non-templated base class member functions though.
```cpp
#include <type_traits>
template <typename T>
struct AlwaysFalse : public std::false_type {};
struct B {
template <typename S>
void foo();
void bar();
};
template <typename T, typename S>
struct A : T {
auto foo() {
static_assert(requires { T::template foo<S>(); }); //fails with clang
static_assert(requires { T::bar(); }); //works with clang and gcc 12.2
}
};
int main() {
A<B, double> a;
a.foo();
}
```
[Godbolt](https://godbolt.org/z/cadYdMj17)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs