From 90a202f2ff241a9f4b11ec625dcc3446cbceb924 Mon Sep 17 00:00:00 2001 From: Victor Vianna Date: Fri, 11 Apr 2025 21:16:33 +0100 Subject: [PATCH] [cpp23] Remove usage of std::aligned_union<> in llvm (#135146) std::aligned_union<> is deprecated in C++23. See more details in the linked bug. Bug: https://crbug.com/388068052 --- compiler-rt/lib/orc/error.h | 4 ++-- llvm/include/llvm/ADT/TrieRawHashMap.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler-rt/lib/orc/error.h b/compiler-rt/lib/orc/error.h index e64332e9ae76..28035095b692 100644 --- a/compiler-rt/lib/orc/error.h +++ b/compiler-rt/lib/orc/error.h @@ -367,8 +367,8 @@ private: } union { - std::aligned_union_t<1, storage_type> TStorage; - std::aligned_union_t<1, error_type> ErrorStorage; + alignas(storage_type) char TStorage[sizeof(storage_type)]; + alignas(error_type) char ErrorStorage[sizeof(error_type)]; }; bool HasError : 1; diff --git a/llvm/include/llvm/ADT/TrieRawHashMap.h b/llvm/include/llvm/ADT/TrieRawHashMap.h index 5bfe5c9e6a0f..e312967edeb5 100644 --- a/llvm/include/llvm/ADT/TrieRawHashMap.h +++ b/llvm/include/llvm/ADT/TrieRawHashMap.h @@ -72,7 +72,7 @@ public: private: template struct AllocValueType { char Base[TrieContentBaseSize]; - std::aligned_union_t Content; + alignas(T) char Content[sizeof(T)]; }; protected: