On Mon, 25 Mar 2019 at 01:33, 叶佑群 wrote: > > Hi,all, I have code as below: > > void check(int & val) > { > std::cout << "int &\n"; > } > > void check(int && val) > { > std::cout << "int &&\n"; > } > > template <typename T> > void print (T && val) > { > check (std::forward<T>(val)); > } > > int main() > { > int x = 0; > print (x); > print (std::move (x)); > } > > I have some problems: > > A、when call print (std::move (x)), the compiler will deduction print to > Void print (int && val) > > So val is a rvalue reference, so check (int && val) should be > invoked, but actually not, why? But actually it is invoked, as the program clearly demonstrates. But this is not a question about GCC, it's about general C++ and so is off topic here.