[mlir] Fix typo in test vector transform pass descriptions (#118194)
[llvm-project.git] / clang / test / SemaCXX / libcxx_move_hack.cpp
blob5c48ed2db6427ccf073fba28a512a90f216c52ed
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.
9 namespace std {
10 struct rv {};
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 &);
22 struct A {};
23 void f(A a, std::rv rv) {
24 a = std::move(a);
25 rv = std::move(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);