This is an archive of the discontinued LLVM Phabricator instance.

Update MSVC version number in preprocessor check
ClosedPublic

Authored by nealsid on May 11 2021, 10:54 AM.

Details

Summary

Passing template parameter packs to std::map doesn't work in VS 2017/2019, so this updates the preprocessor version check to use an alternate version in VS2019, as well.

Diff Detail

Event Timeline

nealsid created this revision.May 11 2021, 10:54 AM
nealsid requested review of this revision.May 11 2021, 10:54 AM
DavidSpickett accepted this revision.May 12 2021, 1:41 AM

Checking https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-160 this LGTM.

I can land this for you, but it would also make a good test commit once you have access. Let me know.

This revision is now accepted and ready to land.May 12 2021, 1:41 AM

Whoops, I did not realize my VS was out of date - appreciate the link. Let me try building with the latest updates, perhaps a later version works.

Re: Testing committing this with commit access would be great, thank you.

Ah, my Windows Boot Camp partition seems to have bit it, so it may be a couple days before I can test & update this, sorry. Please hold off.

Sorry, this got a little complicated. On my previous install I had VS 2019 16.5, which ran into the compile error. When I reinstalled, 16.0, 16.6, and 16.9 worked, but 16.4/16.5 did not. Sounds like a super tiny regression for only 2 minor updates. As far as the actual issue, I could not fully understand it, but it seems to have something to do with applying parameter pack arguments while also using default values for std::map template parameters.

For the actual patch, we could:

  • Leave the version number check at 1926 and update the comment to mention 16.4/16.5 not building is known.
  • Update the preprocessor check to version >= 1920 (which is VS2019 16.0) and != 1924/1925 (16.4/16.5). I'm guessing most people are upgraded past 16.4/16.5 though, so a preprocessor check for those versions may not be used all that much in practice...and would probably hang around the code base forever ;).

Thanks,

Neal

Leave the version number check at 1926 and update the comment to mention 16.4/16.5 not building is known.

I'd do that. If a few versions get the #else version when they could use the first version, it's not going to change much.

DavidSpickett requested changes to this revision.May 17 2021, 1:26 AM
This revision now requires changes to proceed.May 17 2021, 1:26 AM
nealsid updated this revision to Diff 346068.May 18 2021, 1:14 AM
This revision is now accepted and ready to land.May 18 2021, 1:19 AM

Awesome. If you or someone could land it for me, that would be appreciated. Thanks!

This revision was automatically updated to reflect the committed changes.