[compiler-rt] [llvm] [cpp23] Remove usage of std::aligned_union<> in llvm (PR #135146)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 10 02:10:39 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-adt
Author: Victor Vianna (victorvianna)
<details>
<summary>Changes</summary>
std::aligned_union<> is deprecated in C++23. See more details in the linked bug.
---
Full diff: https://github.com/llvm/llvm-project/pull/135146.diff
2 Files Affected:
- (modified) compiler-rt/lib/orc/error.h (+2-2)
- (modified) llvm/include/llvm/ADT/TrieRawHashMap.h (+1-1)
``````````diff
diff --git a/compiler-rt/lib/orc/error.h b/compiler-rt/lib/orc/error.h
index e64332e9ae764..28035095b692a 100644
--- a/compiler-rt/lib/orc/error.h
+++ b/compiler-rt/lib/orc/error.h
@@ -367,8 +367,8 @@ template <typename T> class ORC_RT_NODISCARD Expected {
}
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 5bfe5c9e6a0f4..e312967edeb58 100644
--- a/llvm/include/llvm/ADT/TrieRawHashMap.h
+++ b/llvm/include/llvm/ADT/TrieRawHashMap.h
@@ -72,7 +72,7 @@ class ThreadSafeTrieRawHashMapBase {
private:
template <class T> struct AllocValueType {
char Base[TrieContentBaseSize];
- std::aligned_union_t<sizeof(T), T> Content;
+ alignas(T) char Content[sizeof(T)];
};
protected:
``````````
</details>
https://github.com/llvm/llvm-project/pull/135146
More information about the llvm-commits
mailing list