I upgraded to the latest version of VisualStudio 2017 (15.9.5) to compile our native C++ application. However now in Release mode (and only in Release) I get the following warning (and we treat warnings as errors):
...nothing useful...
6>qrc_IceApplication.cpp
6> Creating library C:/tkbt/Prose/Build/Release/lib/Prose.lib and object C:/tkbt/Prose/Build/Release/lib/Prose.exp
6>Generating code
6>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\functional(1195): error C2220: warning treated as error - no 'executable' file generated
6>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\functional(1195): warning C4789: buffer '_Temp' of size 64 bytes will be overrun; 72 bytes will be written starting at offset 8
6>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\functional(1195): warning C4789: buffer '_Temp' of size 64 bytes will be overrun; 72 bytes will be written starting at offset 8
6>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\functional(1195): warning C4789: buffer '_Temp' of size 64 bytes will be overrun; 72 bytes will be written starting at offset 8
6>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\functional(1195): warning C4789: buffer 'DetectPossibilities' of size 64 bytes will be overrun; 72 bytes will be written starting at offset 8
6>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\functional(1195): warning C4789: buffer '_Temp' of size 64 bytes will be overrun; 72 bytes will be written starting at offset 8
DetectPossibilities is the only thing that has any relation to our code (_Temp does not), and the only thing I can see that is odd is that it is self capturing
std::function<bool(int)> DetectPossibilities;
DetectPossibilities = [&](int startPos) -> bool {
... lots of code
bool nestedAnyFound = DetectPossibilities(startPos + ofMatch.capturedLength());
... lots of code
};
UPDATE: I've found a workaround, and a plausible explanation, so I'm going to post the Q and the A so that the next person doesn't spend the same half-day I did to work out what's going on.