Emulator Issues #12468
closedDolphin failed to build due to "error C2131: expression did not evaluate to a constant" with MSVC on windows
0%
Description
Hi All,
Environment:
VS 2019 + Windows Server 2016 + dolphin master branch latest source code.
Dolphin failed to build due to 'error C2131: expression did not evaluate to a constant' with MSVC on windows. It can be reproduced on latest commit 9d0983c. Could you please help take a look at this issue? Thanks in advance! This issue will be triggered on the upcoming version of MSVC.
Repro steps:
- git clone https://github.com/dolphin-emu/dolphin.git F:\gitP\dolphin-emu\dolphin
- git submodule init
- git submodule update --recursive
- Open a VS 2019 x64 command prompt and browse to F:\gitP\dolphin-emu\dolphin\Source
- set CL=/D_HAS_DEPRECATED_RESULT_OF=1 /D_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING /wd5054
- msbuild /m /p:Platform=x64 /p:Configuration=Release /p:WindowsTargetPlatformVersion=10.0.19041.0 dolphin-emu.sln /t:Dolphin
Actual result:
F:\gitP\dolphin-emu\dolphin\Source\Core\Core\WiiUtils.cpp(112,96): error C2131: expression did not evaluate to a constant
for (const std::string& path : {"/shared2/ec/shopsetu.log", "/shared2/succession/shop.log"})
^
F:\gitP\dolphin-emu\dolphin\Source\Core\Core\WiiUtils.cpp(112,96): note: (sub-)object points to memory which was deallocated during constant evaluation
for (const std::string& path : {"/shared2/ec/shopsetu.log", "/shared2/succession/shop.log"})
^
F:\gitP\dolphin-emu\dolphin\Source\Core\Core\WiiUtils.cpp(131,4): note: while evaluating constexpr function 'WiiUtils::ImportWAD::<lambda_5>::operator ()'
}();
^
Files
Updated by Dentomologist over 3 years ago
I can't reproduce this, but from the error message it looks like you can fix the problem by removing the '&' from line 112 of Source\Core\Core\WiiUtils.cpp to make it match the following:
for (const std::string path : {"/shared2/ec/shopsetu.log", "/shared2/succession/shop.log"})
Let me know if that works and if so I'll make a PR for it.
Updated by JosJuice over 3 years ago
- Status changed from New to Fixed
- Fixed in set to 5.0-13999