From afbd82992ce0a2a9825a3c422b5f74cad91fa87a Mon Sep 17 00:00:00 2001
From: Amelia Coutard <eliottulio.coutard@gmail.com>
Date: Mon, 25 Dec 2023 01:40:21 +0100
Subject: [PATCH] Ajout de declval

---
 libcpp/memory.hpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libcpp/memory.hpp b/libcpp/memory.hpp
index 40c38d5..2c01f93 100644
--- a/libcpp/memory.hpp
+++ b/libcpp/memory.hpp
@@ -17,7 +17,7 @@
 
 // See the C++ documentation for documentation.
 
-// Placement new and delete (taken from glibcxx, should be fine copyright-wise):
+// Implementation for placement new and delete taken from glibcxx.
 [[nodiscard]] inline void* operator new(unsigned long, void* p) noexcept {
 	return p;
 }
@@ -29,7 +29,7 @@ inline void operator delete[](void*, void*) noexcept {}
 
 namespace amy {
 
-// "Launder" taken from glibcxx, should be fine copyright-wise:
+// Implementation for launder taken from glibcxx.
 template <typename T>
 [[nodiscard]] constexpr T* launder(T* p) noexcept {
 	return __builtin_launder(p);
@@ -42,5 +42,9 @@ template <typename T> constexpr size byte_size() {
 template <typename T> constexpr size byte_align() {
 	return alignof(T);
 }
+// Implementation based on https://en.cppreference.com/w/cpp/utility/declval
+template <typename T> constexpr T&& declval() noexcept {
+	static_assert(false, "amy::declval cannot be used in an evaluated context.");
+}
 
 } // namespace amy
-- 
2.46.0