Static asserts in the code below do not fail with MSVC 19.32.31332 for x86:
#include <string>
int main()
{
std::string v = "abc";
auto func = [v]()
{
auto& l_ref = v;
static_assert(std::is_same_v<decltype(l_ref), std::string&>);
auto&& r_ref = std::move(v);
static_assert(std::is_same_v<decltype(r_ref), std::string&&>);
};
func();
return 0;
}
that is MSVC compiler bug. With GCC both l_ref
and r_ref
are const references.
Thanks to stackoverflow.com.
MSVC syntax highlighter (with double Ctrl) displays the references as const: