-
Notifications
You must be signed in to change notification settings - Fork 91
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
Use constexpr compiler bug workaround for VS2017 version 15.9 #57
Conversation
Hi @nightlark, thanks for the patch! Do you have a minimal repro of this by any chance along with the error message? The previous fix regarding I think I'd like to dig a bit deeper into the issue here. The latest cc @mgieseki |
I can confirm the compilation failure with the latest variant sources from master (using VS 2017, version 15.9.5). For example, the following code fails to compile with the messages appended below (sorry, I've only the German locale installed at the moment). #include <mpark/variant.hpp>
#include <memory>
#include <vector>
struct S {
S (int n) : var(n) {}
mpark::variant<int, std::unique_ptr<int>> var;
};
int main () {
std::vector<S> vec;
vec.emplace_back(0);
} Error output:
|
For me, this is enough to reproduce it using the single-header variant (version 15.9.5):
With these errors:
|
I also tested with VS2019 preview 1.1 (version 16.0.0 preview 1.1, MSC_VER == 1920), and the same set of errors occur. |
Strange. For me, this example compiles without errors... |
It is odd -- I have a new laptop with a fresh install of Visual Studio 2017 and 2019 preview, no settings changed from the defaults. |
Does your program actually include the latest single-header file from the master branch or is it perhaps an older version? At first glance, the error messages and line numbers don't seem to match the statements in variant.hpp at the corresponding positions. |
I'll update it with the log from the latest variant.hpp. I realized I might have been using an older version (of variant.hpp) before posting the log, so I updated variant.hpp and still got the same set of errors so I just posted the old log -- which is why the line numbers are off. |
On
This compiles fine for me.
This does not. But this doesn't pass even after applying this patch 😕 |
I should probably get the 19.x version number of the compiler for comparison, since it seems odd that you aren’t getting errors — maybe a different optimization level flag? I guess the thing to do would be to try reproducing the errors in a VM, since each of us seems to be seeing different behavior. |
I can confirm @mpark's summary. It's the exact same behavior on my machine. Obviously, my example triggers an issue that's unrelated to this PR. It was introduced by commit 62b41fe. BTW, my MSVC version is 19.16.27026.1 and I call |
Awesome! Thanks @mpark, with those changes it now compiles with MSVC 2017 and 2019 preview. Seems like compiler bugs are a bit of a theme with the MSVC compilers. |
The latest version of Visual Studio 2017 (15.9) is still affected by the constexpr compiler bug, and they've incremented MSC_VER by 1.