Skip to content

fix: handle MSVC warning C4866: compiler may not enforce left-to-right evaluation order#5641

Merged
henryiii merged 1 commit into
pybind:masterfrom
XuehaiPan:msvc-C4866-warning
May 7, 2025
Merged

fix: handle MSVC warning C4866: compiler may not enforce left-to-right evaluation order#5641
henryiii merged 1 commit into
pybind:masterfrom
XuehaiPan:msvc-C4866-warning

Conversation

@XuehaiPan
Copy link
Copy Markdown
Contributor

@XuehaiPan XuehaiPan commented May 5, 2025

Description

Original error: https://github.com/metaopt/optree/actions/runs/14840166206/job/41660965730?pr=214#step:10:981

Same background (ChatGPT): https://chatgpt.com/share/681d0822-ce30-8008-89a9-74568143f1ee

Copy of error (so search engines pick this up in the future):

C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(1395,5): warning MSB8012: TargetPath(C:\Users\RUNNER~1\AppData\Local\Temp\tmpxvs51ag7.build-lib\optree\_C.cp39-win_amd64.pyd) does not match the Linker's OutputFile property value (C:\Users\RUNNER~1\AppData\Local\Temp\tmpxvs51ag7.build-lib\optree\_C.cp39-win_amd64.pyd). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile). [C:\Users\RUNNER~1\AppData\Local\Temp\tmpat300luf.build-temp\Release\src\_C.vcxproj]
       Creating library C:/Users/RUNNER~1/AppData/Local/Temp/tmpat300luf.build-temp/Release/_C.lib and object C:/Users/RUNNER~1/AppData/Local/Temp/tmpat300luf.build-temp/Release/_C.exp
    Generating code
  C:\Users\runneradmin\AppData\Local\Temp\pip-build-env-cdc2qymv\overlay\Lib\site-packages\pybind11\include\pybind11\detail\function_record_pyobject.h(191): error C2220: the following warning is treated as an error [C:\Users\RUNNER~1\AppData\Local\Temp\tmpat300luf.build-temp\Release\src\_C.vcxproj]
  C:\Users\runneradmin\AppData\Local\Temp\pip-build-env-cdc2qymv\overlay\Lib\site-packages\pybind11\include\pybind11\detail\function_record_pyobject.h(191): error C2220: the following warning is treated as an error [C:\Users\RUNNER~1\AppData\Local\Temp\tmpat300luf.build-temp\Release\src\_C.vcxproj]
  C:\Users\runneradmin\AppData\Local\Temp\pip-build-env-cdc2qymv\overlay\Lib\site-packages\pybind11\include\pybind11\detail\function_record_pyobject.h(191): error C2220: the following warning is treated as an error [C:\Users\RUNNER~1\AppData\Local\Temp\tmpat300luf.build-temp\Release\src\_C.vcxproj]
  C:\Users\runneradmin\AppData\Local\Temp\pip-build-env-cdc2qymv\overlay\Lib\site-packages\pybind11\include\pybind11\detail\function_record_pyobject.h(191): warning C4866: compiler may not enforce left-to-right evaluation order for call to 'pybind11::detail::object_api<pybind11::handle>::operator[]' [C:\Users\RUNNER~1\AppData\Local\Temp\tmpat300luf.build-temp\Release\src\_C.vcxproj]

Suggested changelog entry:

@XuehaiPan XuehaiPan force-pushed the msvc-C4866-warning branch 2 times, most recently from 2efbea6 to 2268f7e Compare May 5, 2025 17:03
@XuehaiPan XuehaiPan force-pushed the msvc-C4866-warning branch from 2268f7e to e29b35b Compare May 5, 2025 17:06
@henryiii henryiii merged commit 002c05b into pybind:master May 7, 2025
65 checks passed
@github-actions github-actions Bot added the needs changelog Possibly needs a changelog entry label May 7, 2025
@XuehaiPan XuehaiPan deleted the msvc-C4866-warning branch May 8, 2025 14:42
@rwgk rwgk removed the needs changelog Possibly needs a changelog entry label May 8, 2025
b-pass pushed a commit to b-pass/pybind11 that referenced this pull request May 9, 2025
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.

3 participants