-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C++] FieldRef with clang-cl from VS 17.4.3 needs operator== with /std:c++20 #15098
Comments
It would seem we need a new CI environment for visual studio & C++20. It should be a fairly straightforward addition to https://github.com/apache/arrow/blob/master/.github/workflows/cpp.yml (we already have Windows / C++17). Would you be interested in contributing that? |
Hmm, I just spent an hour or so trying and this is as close as I got: https://github.com/lukester1975/arrow/actions/runs/3974458277/jobs/6813736037#step:11:1039. This uses However, it fails with what looks like clang-cl related issues with building boost.build ( |
…tion with clang-cl.
Spent a little more time on this. There are various problems with dependencies with a simple addition of a clang-cl environment:
At that point I'm stopping, not something I can spend more time on. The changes are here: https://github.com/lukester1975/arrow/tree/add-vs2022-clang-cl I made a branch with the fix for the actual issue I was reporting. All green: https://github.com/lukester1975/arrow/actions?query=branch%3Afix-clang-cl-c%2B%2B20 Maybe you could consider merging it and adding a CI job to simply attempt to compile the trivial main with clang-cl? Sounds like fixing the whole dependency tree to compile with clang-cl is a lot of work... Thanks |
I apologize for implying it should be straightforward 😆 . I'll see if I can make some headway here. I looked at the fix and my main concern at the moment is I don't understand why it should be needed. |
I'm sure/hopeful it'll be a small window of versions where it's an issue. Definitely didn't see it before. I did notice the Windows VS2022 environment has clang-cl 15.0.5, whereas I only have 15.0.1 (pro vs. community, but it's [claiming to be] fully up-to-date) so with any luck it's already fixed... Thanks |
I was able to reproduce. It looks like C++20 adds some new capability to the equals operator (e.g. default equality, inequality) but adding these features has caused some new restrictions on the equality operator. Namely, if |
OK. FWIW, all compiles OK with gcc (12), clang (15.0.7) and cl (all in c++20 mode), hence why I thought it was specific to clang-cl. |
…33940) If you have an equality operator then C++20 then clang 15 expects it to be symmetric. The util::EqualityComparable operator== was defined as: `bool operator==(util::EqualityComparable<T>, T)` and there is no equivalent: `bool operator==(T, util::EqualityComparable<T>)` This was later determined to be unintentional strictness and the [standard was clarified](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2468r2.html). This error was relaxed in clang 16. Equality only needs to be symmetric if you want the compiler to provide `!=` for you (which we don't rely on). However, it seems like a worthwhile fix, and it doesn't appear that Clang will be backporting the fix to clang 15 (that is my interpretation of the fact that clang lists the defect as clang-16 in this conformance page: https://clang.llvm.org/cxx_status.html). Furthermore, the old definition allowed for `Scalar::operator==(std::shared_ptr<Scalar> other)` (i.e. comparing with a shared_ptr) and it isn't clear to me that should be allowed (it's generally inconsistent with the rest of the code base). This change seems to have undone that and I made no change to restore it (and instead fixed the references to that odd equality operation). BREAKING CHANGE: The functions `bool Scalar::Equals(const std::shared_ptr<Scalar>&) const` and `bool Scalar::Equals(const std::shared_ptr<Scalar>&, const EqualOptions&) const` have been removed. Instead `bool Scalar::Equals(const Scalar&) const` and `bool Scalar::Equals(const Scalar&, const EqualOptions&) const` should be used. BREAKING CHANGE: `FileInfo::ToString` now includes the size and mtime. * Closes: #15098 Authored-by: Weston Pace <weston.pace@gmail.com> Signed-off-by: Weston Pace <weston.pace@gmail.com>
…g 15 (apache#33940) If you have an equality operator then C++20 then clang 15 expects it to be symmetric. The util::EqualityComparable operator== was defined as: `bool operator==(util::EqualityComparable<T>, T)` and there is no equivalent: `bool operator==(T, util::EqualityComparable<T>)` This was later determined to be unintentional strictness and the [standard was clarified](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2468r2.html). This error was relaxed in clang 16. Equality only needs to be symmetric if you want the compiler to provide `!=` for you (which we don't rely on). However, it seems like a worthwhile fix, and it doesn't appear that Clang will be backporting the fix to clang 15 (that is my interpretation of the fact that clang lists the defect as clang-16 in this conformance page: https://clang.llvm.org/cxx_status.html). Furthermore, the old definition allowed for `Scalar::operator==(std::shared_ptr<Scalar> other)` (i.e. comparing with a shared_ptr) and it isn't clear to me that should be allowed (it's generally inconsistent with the rest of the code base). This change seems to have undone that and I made no change to restore it (and instead fixed the references to that odd equality operation). BREAKING CHANGE: The functions `bool Scalar::Equals(const std::shared_ptr<Scalar>&) const` and `bool Scalar::Equals(const std::shared_ptr<Scalar>&, const EqualOptions&) const` have been removed. Instead `bool Scalar::Equals(const Scalar&) const` and `bool Scalar::Equals(const Scalar&, const EqualOptions&) const` should be used. BREAKING CHANGE: `FileInfo::ToString` now includes the size and mtime. * Closes: apache#15098 Authored-by: Weston Pace <weston.pace@gmail.com> Signed-off-by: Weston Pace <weston.pace@gmail.com>
…g 15 (apache#33940) If you have an equality operator then C++20 then clang 15 expects it to be symmetric. The util::EqualityComparable operator== was defined as: `bool operator==(util::EqualityComparable<T>, T)` and there is no equivalent: `bool operator==(T, util::EqualityComparable<T>)` This was later determined to be unintentional strictness and the [standard was clarified](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2468r2.html). This error was relaxed in clang 16. Equality only needs to be symmetric if you want the compiler to provide `!=` for you (which we don't rely on). However, it seems like a worthwhile fix, and it doesn't appear that Clang will be backporting the fix to clang 15 (that is my interpretation of the fact that clang lists the defect as clang-16 in this conformance page: https://clang.llvm.org/cxx_status.html). Furthermore, the old definition allowed for `Scalar::operator==(std::shared_ptr<Scalar> other)` (i.e. comparing with a shared_ptr) and it isn't clear to me that should be allowed (it's generally inconsistent with the rest of the code base). This change seems to have undone that and I made no change to restore it (and instead fixed the references to that odd equality operation). BREAKING CHANGE: The functions `bool Scalar::Equals(const std::shared_ptr<Scalar>&) const` and `bool Scalar::Equals(const std::shared_ptr<Scalar>&, const EqualOptions&) const` have been removed. Instead `bool Scalar::Equals(const Scalar&) const` and `bool Scalar::Equals(const Scalar&, const EqualOptions&) const` should be used. BREAKING CHANGE: `FileInfo::ToString` now includes the size and mtime. * Closes: apache#15098 Authored-by: Weston Pace <weston.pace@gmail.com> Signed-off-by: Weston Pace <weston.pace@gmail.com>
Describe the bug, including details regarding any error messages, version, and platform.
Hi
Compiling
with
clang-cl test.cpp -I/path/to/arrow /std:c++20
fails:
I don't recall seeing this previously, so maybe a change with the 17.4(.3?) release. variant impl, maybe.
A simple
bool operator==(const FieldRef& other) const { return Equals(other); }
added toFieldRef
fixes the compilation. I can made a PR if you like.Thanks
Component(s)
C++
The text was updated successfully, but these errors were encountered: