https://bugs.gentoo.org/904725 https://bugs.gentoo.org/904850 From 451fb9470e4e1cd183ff05d5e171dc21bae6e47c Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Thu, 16 Mar 2023 13:29:48 +0100 Subject: [PATCH] Another C++20 fix for GCC This is a direct backport of commit 95d0d8e9e9d10da3cfa503fbba405e740aea3cc1 from Richard Smith: From: Richard Smith Date: Tue, 23 Feb 2021 14:07:13 -0800 Subject: Fix constructor declarations that are invalid in C++20 onwards. Fix constructor declarations that are invalid in C++20 onwards. Under C++ CWG DR 2237, the constructor for a class template C must be written as 'C(...)' not as 'C(...)'. This fixes a build failure with GCC in C++20 mode. In passing, remove some other redundant '' qualification from the affected classes. Bug: chromium:819294 Change-Id: I51a7f069d355d4932f4b50640fedbba1d5773f0b Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/71088 Kokoro-Result: kokoro Reviewed-by: Shahbaz Youssefi Tested-by: Shahbaz Youssefi Commit-Queue: Shahbaz Youssefi --- --- a/third_party/swiftshader/third_party/llvm-10.0/llvm/include/llvm/ADT/STLExtras.h +++ b/third_party/swiftshader/third_party/llvm-10.0/llvm/include/llvm/ADT/STLExtras.h @@ -1415,9 +1415,9 @@ result_pair(std::size_t Index, IterOfRange Iter) : Index(Index), Iter(Iter) {} - result_pair(const result_pair &Other) + result_pair(const result_pair &Other) : Index(Other.Index), Iter(Other.Iter) {} - result_pair &operator=(const result_pair &Other) { + result_pair &operator=(const result_pair &Other) { Index = Other.Index; Iter = Other.Iter; return *this; @@ -1451,22 +1451,22 @@ result_type &operator*() { return Result; } const result_type &operator*() const { return Result; } - enumerator_iter &operator++() { + enumerator_iter &operator++() { assert(Result.Index != std::numeric_limits::max()); ++Result.Iter; ++Result.Index; return *this; } - bool operator==(const enumerator_iter &RHS) const { + bool operator==(const enumerator_iter &RHS) const { // Don't compare indices here, only iterators. It's possible for an end // iterator to have different indices depending on whether it was created // by calling std::end() versus incrementing a valid iterator. return Result.Iter == RHS.Result.Iter; } - enumerator_iter(const enumerator_iter &Other) : Result(Other.Result) {} - enumerator_iter &operator=(const enumerator_iter &Other) { + enumerator_iter(const enumerator_iter &Other) : Result(Other.Result) {} + enumerator_iter &operator=(const enumerator_iter &Other) { Result = Other.Result; return *this; } From e4dea744b7838470757f010fc2ff4b92f02b3fac Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Thu, 16 Mar 2023 13:29:54 +0100 Subject: [PATCH] More C++20 fixes Partial backport of llvm-project patch: commit 2ccf0b76bcaf0895e04f14e3ff53c59dd96f9f0f Author: Evgeny Mandrikov Date: Thu Jan 6 17:01:05 2022 +0100 Fix build failure with GCC 11 in C++20 mode See https://wg21.link/cwg2237 Reviewed By: shafik, dexonsmith Differential Revision: https://reviews.llvm.org/D115355 Bug: chromium:819294 Change-Id: I90d58b6fc601f9a4f615e2f6edc13a73ce848e4f Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/71089 Reviewed-by: Shahbaz Youssefi Tested-by: Shahbaz Youssefi Kokoro-Result: kokoro Commit-Queue: Shahbaz Youssefi --- --- a/third_party/swiftshader/third_party/llvm-10.0/llvm/include/llvm/CodeGen/LiveInterval.h +++ b/third_party/swiftshader/third_party/llvm-10.0/llvm/include/llvm/CodeGen/LiveInterval.h @@ -718,7 +718,7 @@ T *P; public: - SingleLinkedListIterator(T *P) : P(P) {} + SingleLinkedListIterator(T *P) : P(P) {} SingleLinkedListIterator &operator++() { P = P->Next; --- a/third_party/swiftshader/third_party/llvm-10.0/llvm/include/llvm/Support/BinaryStreamArray.h +++ b/third_party/swiftshader/third_party/llvm-10.0/llvm/include/llvm/Support/BinaryStreamArray.h @@ -324,7 +324,7 @@ FixedStreamArrayIterator(const FixedStreamArray &Array, uint32_t Index) : Array(Array), Index(Index) {} - FixedStreamArrayIterator(const FixedStreamArrayIterator &Other) + FixedStreamArrayIterator(const FixedStreamArrayIterator &Other) : Array(Other.Array), Index(Other.Index) {} FixedStreamArrayIterator & operator=(const FixedStreamArrayIterator &Other) {