Since Clang 22, Clang starts rejecting the following code snippet (Godbolt link), which is perhaps incorrect.
Note that Clang behaves as expected if two nested classes are of different names.
struct A {
class Nested { // N.B. Both nested classes have the same name.
private:
static void test_function();
};
};
template <class T>
concept has_member_test_function = requires {
T::test_function();
};
static_assert(!has_member_test_function<A::Nested>);
struct B {
struct Nested { // N.B. Both nested classes have the same name.
template <class T>
requires has_member_test_function<T>
Nested(const T&);
};
};
template <class From, class To>
concept quick_convertible_to = requires(From&& t, void (&fun)(To)) {
fun(static_cast<From&&>(t));
};
static_assert(!quick_convertible_to<A::Nested, B::Nested>);
Since Clang 22, Clang starts rejecting the following code snippet (Godbolt link), which is perhaps incorrect.
Note that Clang behaves as expected if two nested classes are of different names.