[ 
https://issues.apache.org/jira/browse/ARROW-17408?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17580127#comment-17580127
 ] 

Xuwei Fu commented on ARROW-17408:
----------------------------------

[~apitrou] Hi, mind take a look? My fixing works for C++20, but would not 
compile in some platforms. Should I add some macros that make it only works in 
C++20?

> C++20 compile arrow get `operator==` ambiguous
> ----------------------------------------------
>
>                 Key: ARROW-17408
>                 URL: https://issues.apache.org/jira/browse/ARROW-17408
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: C++
>    Affects Versions: 9.0.0
>            Reporter: Xuwei Fu
>            Priority: Trivial
>              Labels: pull-request-available
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> When compiling arrow-9.0.0 in C++20, I got:
>  
> ```
> In file included from ../arrow/cpp/src/arrow/ipc/dictionary.cc:32:
> ../arrow/cpp/src/arrow/record_batch.h:266:21: warning: ISO C++20 considers 
> use of overloaded operator '==' (with operand types 'const 
> Result<std::shared_ptr<RecordBatch>>' and 'const 
> Result<std::shared_ptr<RecordBatch>>') to be ambiguous despite there being a 
> unique best viable function [-Wambiguous-reversed-operator]
>       return batch_ == other.batch_;
>              ~~~~~~ ^  ~~~~~~~~~~~~
> ../arrow/cpp/src/arrow/util/compare.h:54:8: note: ambiguity is between a 
> regular call to this operator and a call with the argument order reversed
>   bool operator==(const T& other) const \{ return cast().Equals(other); }
>        ^
> In file included from ../arrow/cpp/src/arrow/ipc/dictionary.cc:18:
> In file included from ../arrow/cpp/src/arrow/ipc/dictionary.h:27:
> ../arrow/cpp/src/arrow/result.h:278:20: warning: ISO C++20 considers use of 
> overloaded operator '==' (with operand types 'const arrow::Status' and 'const 
> arrow::Status') to be ambiguous despite there being a unique best viable 
> function [-Wambiguous-reversed-operator]
>     return status_ == other.status_;
>            ~~~~~~~ ^  ~~~~~~~~~~~~~
> ../arrow/cpp/src/arrow/util/compare.h:54:57: note: in instantiation of member 
> function 'arrow::Result<std::shared_ptr<arrow::RecordBatch>>::Equals' 
> requested here
>   bool operator==(const T& other) const \{ return cast().Equals(other); }
>                                                         ^
> ../arrow/cpp/src/arrow/record_batch.h:266:21: note: in instantiation of 
> member function 
> 'arrow::util::EqualityComparable<arrow::Result<std::shared_ptr<arrow::RecordBatch>>>::operator=='
>  requested here
>       return batch_ == other.batch_;
>                     ^
> ../arrow/cpp/src/arrow/util/compare.h:54:8: note: ambiguity is between a 
> regular call to this operator and a call with the argument order reversed
>   bool operator==(const T& other) const \{ return cast().Equals(other); }
>        ^
> 2 warnings generated.
> In file included from ../arrow/cpp/src/arrow/ipc/message.cc:33:
> In file included from ../arrow/cpp/src/arrow/ipc/reader.h:32:
> ../arrow/cpp/src/arrow/record_batch.h:266:21: warning: ISO C++20 considers 
> use of overloaded operator '==' (with operand types 'const 
> Result<std::shared_ptr<RecordBatch>>' and 'const 
> Result<std::shared_ptr<RecordBatch>>') to be ambiguous despite there being a 
> unique best viable function [-Wambiguous-reversed-operator]
>       return batch_ == other.batch_;
>              ~~~~~~ ^  ~~~~~~~~~~~~
> ../arrow/cpp/src/arrow/util/compare.h:54:8: note: ambiguity is between a 
> regular call to this operator and a call with the argument order reversed
>   bool operator==(const T& other) const \{ return cast().Equals(other); }
>        ^
> In file included from ../arrow/cpp/src/arrow/ipc/message.cc:18:
> In file included from ../arrow/cpp/src/arrow/ipc/message.h:30:
> ../arrow/cpp/src/arrow/result.h:278:20: warning: ISO C++20 considers use of 
> overloaded operator '==' (with operand types 'const arrow::Status' and 'const 
> arrow::Status') to be ambiguous despite there being a unique best viable 
> function [-Wambiguous-reversed-operator]
>     return status_ == other.status_;
>            ~~~~~~~ ^  ~~~~~~~~~~~~~
> ../arrow/cpp/src/arrow/util/compare.h:54:57: note: in instantiation of member 
> function 'arrow::Result<std::shared_ptr<arrow::RecordBatch>>::Equals' 
> requested here
>   bool operator==(const T& other) const \{ return cast().Equals(other); }
>                                                         ^
> ../arrow/cpp/src/arrow/record_batch.h:266:21: note: in instantiation of 
> member function 
> 'arrow::util::EqualityComparable<arrow::Result<std::shared_ptr<arrow::RecordBatch>>>::operator=='
>  requested here
>       return batch_ == other.batch_;
>                     ^
> ../arrow/cpp/src/arrow/util/compare.h:54:8: note: ambiguity is between a 
> regular call to this operator and a call with the argument order reversed
>   bool operator==(const T& other) const \{ return cast().Equals(other); }
> ```
>  
> Generate or hand written `operator==` for `Result` maybe fixing this problem. 
> Seems problems cames from: 
> https://stackoverflow.com/questions/65833022/inherited-synthesized-comparison-operator-produces-warning-error-iso-c20-cons



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to