Skip to content

Commit 35888fe

Browse files
joyeecheungV8 LUCI CQ
authored andcommitted
[base] fix builds with GCC 12 on certain Linux distributions
With GCC 12 on certain Linux distributions (at least Debian 12, Alpine 3.18, Fedora 37, that ships GCC 12.2), std::is_trivially_copyable is broken and as a result, V8 fails to compile. This patch uses the same polyfill on MSVC to make it compile with GCC 12.2. See nodejs/node#45427 for more context. Refs: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=aeba3e009b0abfccaf01797556445dbf891cc8dc Change-Id: Ie0ab1bb1ec105bacbd80b341adf7dbd8569f031f Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5679182 Commit-Queue: Joyee Cheung <[email protected]> Reviewed-by: Nico Hartmann <[email protected]> Cr-Commit-Position: refs/heads/main@{#95181}
1 parent 856de69 commit 35888fe

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/base/macros.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,19 @@ namespace base {
206206
// base::is_trivially_copyable will differ for these cases.
207207
template <typename T>
208208
struct is_trivially_copyable {
209-
#if V8_CC_MSVC
209+
#if V8_CC_MSVC || (__GNUC__ == 12 && __GNUC_MINOR__ <= 2)
210210
// Unfortunately, MSVC 2015 is broken in that std::is_trivially_copyable can
211211
// be false even though it should be true according to the standard.
212212
// (status at 2018-02-26, observed on the msvc waterfall bot).
213213
// Interestingly, the lower-level primitives used below are working as
214214
// intended, so we reimplement this according to the standard.
215215
// See also https://developercommunity.visualstudio.com/content/problem/
216216
// 170883/msvc-type-traits-stdis-trivial-is-bugged.html.
217+
//
218+
// GCC 12.1 and 12.2 are broken too, they are shipped by some stable Linux
219+
// distributions, so the same polyfill is also used.
220+
// See
221+
// https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=aeba3e009b0abfccaf01797556445dbf891cc8dc
217222
static constexpr bool value =
218223
// Copy constructor is trivial or deleted.
219224
(std::is_trivially_copy_constructible<T>::value ||

0 commit comments

Comments
 (0)