1 // RUN: %clang_cc1 -fsyntax-only %s -std=c++98 -verify
2 // expected-no-diagnostics
4 // This is a test for a hack in Clang that works around an issue with libc++
5 // 3.1's std::move and std::forward implementation. When emulating these
6 // functions in C++98 mode, libc++ 3.1 has a "fake rvalue reference" type, and
7 // std::move will return by value when given an instance of that type.
12 template<bool B
, typename T
> struct enable_if
;
13 template<typename T
> struct enable_if
<true, T
> { typedef T type
; };
15 template<typename T
> typename enable_if
<__is_convertible(T
, rv
), T
>::type
move(T
&);
16 template<typename T
> typename enable_if
<!__is_convertible(T
, rv
), T
&>::type
move(T
&);
18 template<typename U
, typename T
> typename enable_if
<__is_convertible(T
, rv
), U
>::type
forward(T
&);
19 template<typename U
, typename T
> typename enable_if
<!__is_convertible(T
, rv
), U
&>::type
forward(T
&);
23 void f(A a
, std::rv rv
) {
27 a
= std::forward
<A
>(a
);
28 rv
= std::forward
<std::rv
>(rv
);
30 a
= std::forward
<A
&>(a
);
31 rv
= std::forward
<std::rv
&>(rv
);