#include <utility>
#include <type_traits>
#include <iostream>
struct foo{};
template<typename T>
void bar2(T&& t)
{
std::cout << __PRETTY_FUNCTION__ << ' '
<< std::is_rvalue_reference<decltype(t)>::value << '\n';
}
template<typename T>
void bar1(T&& t)
{
std::cout << __PRETTY_FUNCTION__ << ' '
<< std::is_rvalue_reference<decltype(t)>::value << '\n';
bar2(std::forward<T>(t));
bar2(t);
}
int main()
{
foo f;
bar1(f);
std::cout << "--------\n";
bar1(foo{});
}
I2luY2x1ZGUgPHV0aWxpdHk+CiNpbmNsdWRlIDx0eXBlX3RyYWl0cz4KI2luY2x1ZGUgPGlvc3RyZWFtPgoKc3RydWN0IGZvb3t9OwoKdGVtcGxhdGU8dHlwZW5hbWUgVD4Kdm9pZCBiYXIyKFQmJiB0KQp7CiAgICBzdGQ6OmNvdXQgPDwgX19QUkVUVFlfRlVOQ1RJT05fXyA8PCAnICcKICAgICAgICAgICAgICAgPDwgc3RkOjppc19ydmFsdWVfcmVmZXJlbmNlPGRlY2x0eXBlKHQpPjo6dmFsdWUgPDwgJ1xuJzsKfQoKdGVtcGxhdGU8dHlwZW5hbWUgVD4Kdm9pZCBiYXIxKFQmJiB0KQp7CiAgICBzdGQ6OmNvdXQgPDwgX19QUkVUVFlfRlVOQ1RJT05fXyA8PCAnICcKICAgICAgICAgICAgICA8PCBzdGQ6OmlzX3J2YWx1ZV9yZWZlcmVuY2U8ZGVjbHR5cGUodCk+Ojp2YWx1ZSA8PCAnXG4nOwogICAgYmFyMihzdGQ6OmZvcndhcmQ8VD4odCkpOwogICAgYmFyMih0KTsKfQoKaW50IG1haW4oKQp7CiAgICBmb28gZjsKICAgIGJhcjEoZik7CiAgICBzdGQ6OmNvdXQgPDwgIi0tLS0tLS0tXG4iOwogICAgYmFyMShmb297fSk7Cn0K