p3-0x.cpp revision 2ad746aeb90e86cea7afaf552a02ae3f3b5ec859
1// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
2
3
4// If P is an rvalue reference to a cv-unqualified template parameter
5// and the argument is an lvalue, the type "lvalue reference to A" is
6// used in place of A for type deduction.
7template<typename T> struct X { };
8
9template<typename T> X<T> f0(T&&);
10
11struct Y { };
12
13template<typename T> T prvalue();
14template<typename T> T&& xvalue();
15template<typename T> T& lvalue();
16
17void test_f0() {
18  X<int> xi0 = f0(prvalue<int>());
19  X<int> xi1 = f0(xvalue<int>());
20  X<int&> xi2 = f0(lvalue<int>());
21  X<Y> xy0 = f0(prvalue<Y>());
22  X<Y> xy1 = f0(xvalue<Y>());
23  X<Y&> xy2 = f0(lvalue<Y>());
24}
25