CDRIVER-5996 Address EVG task failure due to possible VS 2017 compiler bug #2041
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Followup to #1999. Addresses ongoing VS 2017 test task failures due to what seems to be a VS 2017 compiler bug. Narrowed the issue down to what seems to be a poor interaction between the conditional operator and compound literals, which manifests in the expansion of the
mlib_upsize_integer
macro:I am unable to reproduce this behavior on any other currently tested or supported compiler (GCC, Clang, MSVC). I could not find any Visual Studio bug reports relating to this behavior. This behavior does not seem to be present with VS 2019 and newer. Quoting the C99 draft:
Similarly quoting the C++11 draft:
The behavior observed above with VS 2017 clearly violates both of these specifications. I suspect it is an unfortunate consequence of partial C language support in VS 2017. The behavior is as expected if the compound literals are removed:
Rather than complicating the definition of the
mlib_*
macros any further, this PR proposes simply skipping these tests when compiled with VS 2017 or older. We are unlikely to be (and should be avoiding) using these macros with expressions containing side-effects anyways.