#include <iostream>
#include <type_traits>
using namespace std;
template <typename T>
struct A {
A(const T&) {
cout << "A(const A&)" << endl;
}
A(T&&) {
cout << "A(T&&)" << endl;
}
};
template <typename T>
A(T&&) -> A<std::remove_reference_t<T>>;
int main() {
auto integer{1};
A{1};
A{integer};
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dHlwZV90cmFpdHM+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdGVtcGxhdGUgPHR5cGVuYW1lIFQ+CnN0cnVjdCBBIHsKICAgIEEoY29uc3QgVCYpIHsKICAgICAgICBjb3V0IDw8ICJBKGNvbnN0IEEmKSIgPDwgZW5kbDsKICAgIH0KICAgIEEoVCYmKSB7CiAgICAgICAgY291dCA8PCAiQShUJiYpIiA8PCBlbmRsOwogICAgfQp9OwoKdGVtcGxhdGUgPHR5cGVuYW1lIFQ+CkEoVCYmKSAtPiBBPHN0ZDo6cmVtb3ZlX3JlZmVyZW5jZV90PFQ+PjsKCmludCBtYWluKCkgewogICAgYXV0byBpbnRlZ2VyezF9OwogICAgQXsxfTsKICAgIEF7aW50ZWdlcn07CiAgICByZXR1cm4gMDsKfQo=
prog.cpp:17:40: error: expected constructor, destructor, or type conversion before ‘;’ token
A(T&&) -> A<std::remove_reference_t<T>>;
^
prog.cpp: In function ‘int main()’:
prog.cpp:21:6: error: missing template arguments before ‘{’ token
A{1};
^
prog.cpp:22:6: error: missing template arguments before ‘{’ token
A{integer};
^