When I have a function template like this:
template<class T>
T func(T bar) {
return bar;
}
I cannot use its instantiation in constant context with the latest MSVC compiler:
constexpr bool b = std::is_function_v<decltype(func<int>)>; // fails with error C2131: expression did not evaluate to a constant
static_assert(std::is_compound_v<decltype(func<int>)>); // fails with C2057: expected constant expression
You can test it yourself in compiler explorer.
It works with older MSVC versions and with GCC and Clang. Is it a compiler bug, or is it expected behavior?