[libcxx-commits] [libcxx] [libc++] Diagnoses insufficiently aligned pointers for std::assume_aligned during constant evaluation (PR #73775)

Rajveer Singh Bharadwaj via libcxx-commits libcxx-commits at lists.llvm.org
Sun Dec 3 04:07:14 PST 2023


================
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
+// #include <memory>
+
+// template<size_t N, class T>
+// [[nodiscard]] constexpr T* assume_aligned(T* ptr);
+
+// Diagnose insufficiently aligned pointers during constant evaluation.
+// ADDITIONAL_COMPILE_FLAGS: -Xclang -verify-ignore-unexpected=error -Xclang -verify-ignore-unexpected=warning
+
+#include <memory>
+
+template <size_t Size>
+constexpr bool test() {
+  auto data  = new char[1];
----------------
Rajveer100 wrote:

What do you mean by stack data?

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


More information about the libcxx-commits mailing list