[clang] [clang][Interp] Handle std::move etc. builtins (PR #70772)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 19 02:36:36 PST 2024


================
@@ -378,3 +378,92 @@ namespace Packs {
   static_assert(foo<int, char>() == 2, "");
   static_assert(foo<>() == 0, "");
 }
+
+namespace std {
+template <typename T> struct remove_reference { using type = T; };
+template <typename T> struct remove_reference<T &> { using type = T; };
+template <typename T> struct remove_reference<T &&> { using type = T; };
+template <typename T>
+constexpr typename std::remove_reference<T>::type&& move(T &&t) noexcept {
+  return static_cast<typename std::remove_reference<T>::type &&>(t);
+}
+}
+/// The std::move declaration above gets translated to a builtin function.
+namespace Move {
----------------
tbaederr wrote:

I've enabled `test/SemaCXX/builtin-std-move.cpp` with the new interpreter.

https://github.com/llvm/llvm-project/pull/70772


More information about the cfe-commits mailing list