From 95d0d8e9e9d10da3cfa503fbba405e740aea3cc1 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Tue, 23 Feb 2021 14:07:13 -0800 Subject: [PATCH] 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. --- llvm/include/llvm/ADT/STLExtras.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h index 63c7f48a5bd2..7741edf04959 100644 --- a/llvm/include/llvm/ADT/STLExtras.h +++ b/llvm/include/llvm/ADT/STLExtras.h @@ -1820,9 +1820,9 @@ template struct result_pair { 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; @@ -1856,22 +1856,22 @@ public: 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; }