Clang rejects the following code:
#include <concepts>
struct k { static void f(); };
// clang nope, gcc ok, msvc ok
static_assert(std::same_as<decltype(k::f), decltype(k{}.f)>);
Which seems to boil down to whether decltype(k{}.f) should either be inspected as type void(), type void (&)() or even type void (&&)(). When parenthesizing k{}.f (i.e.: decltype((k{}.f))), both Clang and GCC agree on type void (&)(), while MSVC regards the expression as type void (&&)(). This seems to suggest that both GCC and MSVC do not regard the type-inspection of plain k{}.f as an lvalue-expression.
I presume there is no special exception with decltype when inspecting static member-functions in the form of k{}.f. Therefore, does this mean that both GCC and MSVC are non-conformant?
k::fis an invalid syntax in case of non-static member functions. Clangs seems to extend this invalidity to static member functions. Hence,decltype(k::f)can't be deduced. May be a bug.decltype(k::f)can't be deduced? All compilers seem to deduce it to typevoid().k::fis invalid id-expression in C++ iffis a non-static member function.&k::fis valid.