Skip to content

Commit 6a5dd04

Browse files
committed
[Support] Try to fix AlignedCharArrayUnion with GCC 7.5
Work around "internal compiler error: Segmentation fault", apparently caused by alignas(Ts...).
1 parent 5e4938a commit 6a5dd04

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/include/llvm/Support/AlignOf.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ namespace llvm {
2020
/// A suitably aligned and sized character array member which can hold elements
2121
/// of any type.
2222
template <typename T, typename... Ts> struct AlignedCharArrayUnion {
23-
alignas(T) alignas(Ts...) char buffer[std::max({sizeof(T), sizeof(Ts)...})];
23+
// Work around "internal compiler error: Segmentation fault" with GCC 7.5,
24+
// apparently caused by alignas(Ts...).
25+
static constexpr std::size_t Align = std::max({alignof(T), alignof(Ts)...});
26+
alignas(Align) char buffer[std::max({sizeof(T), sizeof(Ts)...})];
2427
};
2528

2629
} // end namespace llvm

0 commit comments

Comments
 (0)