Closed
Description
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.
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();
}
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done