Skip to content
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

Fix for Windows compiler, missing object initializer #4188

Merged
merged 2 commits into from
Sep 20, 2022

Conversation

jiwaszki
Copy link
Contributor

@jiwaszki jiwaszki commented Sep 19, 2022

Description

Added missing object initializer due to error while compiling with Visual Studio 2019 MSC v. 1924:

error: C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized

Suggested changelog entry:

* Fix MSVC 2019 v.1924 & C++14 mode error for `overload_cast`.

@jiwaszki
Copy link
Contributor Author

One question - is it possible to port this change to 2.10.0 or add to future fix version?

@@ -1037,7 +1037,7 @@ template <typename... Args>
|| (defined(__clang__) && __clang_major__ == 5)
static constexpr detail::overload_cast_impl<Args...> overload_cast = {};
# else
static constexpr detail::overload_cast_impl<Args...> overload_cast;
static constexpr detail::overload_cast_impl<Args...> overload_cast{};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uhm ... wait, do we actually need this ugly #ifdef?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean maybe the new version works on all compilers?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also why weren't we seeing the errors with newer MSVC? We should be testing with 2019 & 2022 (maybe not 2017 anywhere anymore).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean maybe the new version works on all compilers?

Yes, I tried it out, CI is green: #4190

Whatever made the #ifdef necessary in the past, it doesn't seem to be an issue anymore with the compilers we support today.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uhm ... wait, do we actually need this ugly #ifdef?

Actually if the {} is present, this #ifdef can be removed. I will cover that in next commit and run checks.

Also why weren't we seeing the errors with newer MSVC?

My bad, I have got lost in the logs of the project and actual MSVC build version is 1924. Maybe this version is not covered? Also I see that -DCMAKE_CXX_STANDARD=17/20 is set for Windows builds, is C++14 covered as well?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I bet no one ever tried it with {}, but only with = {}.

I'm hoping to get a patch release out in ~1 week or so. Still have a few items on #4125 left.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@henryiii Thanks for the answer, can't wait to finally bump version in OpenVINO!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@henryiii As fix version 2.10.1 is going to be released, will it include this PR and everything from the master branch up to this point? I am not accustom to pybind's release practices, I am really sorry for such questions.

(I do not want to spam in #4125 comments, hope you don't mind:))

Copy link
Collaborator

@henryiii henryiii Oct 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should. I think there might be one or two breaking changes which could go in before it releases, which means we'll branch from there, but so far master is 2.10.1. I'm going to finish investigation into the CMake caching issue in the next couple of days, then make a release.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed my target, but 2.10.1 is out now.

@henryiii henryiii merged commit 424ac4f into pybind:master Sep 20, 2022
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Sep 20, 2022
@Skylion007
Copy link
Collaborator

@rwgk Did we actually test if this works C++14 on MSVC? Seems like our CI might not be running that edge case?

@Skylion007
Copy link
Collaborator

Opened #4191 to make sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants