Skip to content

Commit 95d0d8e

Browse files
committed
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<T>(...)'. This fixes a build failure with GCC in C++20 mode. In passing, remove some other redundant '<T>' qualification from the affected classes.
1 parent c7d46f2 commit 95d0d8e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/include/llvm/ADT/STLExtras.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -1820,9 +1820,9 @@ template <typename R> struct result_pair {
18201820
result_pair(std::size_t Index, IterOfRange<R> Iter)
18211821
: Index(Index), Iter(Iter) {}
18221822

1823-
result_pair<R>(const result_pair<R> &Other)
1823+
result_pair(const result_pair<R> &Other)
18241824
: Index(Other.Index), Iter(Other.Iter) {}
1825-
result_pair<R> &operator=(const result_pair<R> &Other) {
1825+
result_pair &operator=(const result_pair &Other) {
18261826
Index = Other.Index;
18271827
Iter = Other.Iter;
18281828
return *this;
@@ -1856,22 +1856,22 @@ class enumerator_iter
18561856
result_type &operator*() { return Result; }
18571857
const result_type &operator*() const { return Result; }
18581858

1859-
enumerator_iter<R> &operator++() {
1859+
enumerator_iter &operator++() {
18601860
assert(Result.Index != std::numeric_limits<size_t>::max());
18611861
++Result.Iter;
18621862
++Result.Index;
18631863
return *this;
18641864
}
18651865

1866-
bool operator==(const enumerator_iter<R> &RHS) const {
1866+
bool operator==(const enumerator_iter &RHS) const {
18671867
// Don't compare indices here, only iterators. It's possible for an end
18681868
// iterator to have different indices depending on whether it was created
18691869
// by calling std::end() versus incrementing a valid iterator.
18701870
return Result.Iter == RHS.Result.Iter;
18711871
}
18721872

1873-
enumerator_iter<R>(const enumerator_iter<R> &Other) : Result(Other.Result) {}
1874-
enumerator_iter<R> &operator=(const enumerator_iter<R> &Other) {
1873+
enumerator_iter(const enumerator_iter &Other) : Result(Other.Result) {}
1874+
enumerator_iter &operator=(const enumerator_iter &Other) {
18751875
Result = Other.Result;
18761876
return *this;
18771877
}

0 commit comments

Comments
 (0)