<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56173>56173</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Building LLVM fails with older versions of VC++ compiler after adding /permissive- switch in df6291a6
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          dyung
      </td>
    </tr>
</table>

<pre>
    We hit an issue internally where our Windows build bots were suddenly failing to build LLVM which I bisected back to be caused by df6291a666d3be784e2bbd00e4dbcdcceaf0196f.

According to the LLVM documentation at https://llvm.org/docs/GettingStarted.html, the minimum required toolchain for building using Visual Studio is Visual Studio 2019 16.7. According to wikipedia, Visual Studio 2019 16.7 corresponds to the 19.27 version of the Visual C++ compiler. The version installed on our build machines is 19.28.29915.0, which should be a supported version of Visual C++. However, when we attempt to build LLVM with the newly added `/permissive-` switch, we get many errors similar to the following:
```
C:\src\upstream\llvm_clean_git\clang\include\clang/Basic/Sanitizers.def(41,1): error C2131: expression did not evaluate to a constant [C:\src\upstream\df6291a666d3-PS4-Release\tools\clang\lib\Basic\obj.clangBasic.vcxproj]
C:\src\upstream\llvm_clean_git\clang\include\clang/Basic/Sanitizers.def(41,1): message : failure was caused by call of undefined function or one not declared 'constexpr' [C:\src\upstream\df6291a666d3-PS4-Release\tools\clang\lib\Basic\obj.clangBasic.vcxproj]
C:\src\upstream\llvm_clean_git\clang\include\clang/Basic/Sanitizers.def(41,1): message : see usage of 'clang::SanitizerMask::bitPosToMask' [C:\src\upstream\df6291a666d3-PS4-Release\tools\clang\lib\Basic\obj.clangBasic.vcxproj]
```
I did note however that a later version of the Visual C++ compiler that I have installed on my local machine, 19.29.30141.0, was able to compile the code with no errors when using `/permissive-`, so it appears that it may be a problem with an older, but still supported version of the Visual C++ compiler.

I am attaching a zipped preprocessed file ([repro3.zip](https://github.com/llvm/llvm-project/files/8965792/repro3.zip)) that when compiled with the older version of Visual C++ (`cl.exe /c /permissive- repro3.cpp`) it will give the error mentioned above, while using a more recent version like what I have installed on my local machine compiles it with no errors. We should fix this so that it works with all currently supported versions of the host toolchain.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzlVk2P2zYQ_TXyhVhBlla2dfBh18G2CyRA0A2SY0CRI4tZilRFyo7z6_tIyRs7H0V6aQ8FbInix8zjzOMb1laeth-ItcozbphybiSmjKfBcK1P7NjSQMyOA_ugjLRHx-pRaclq6x07hjE3SkkGUxuutDJ75u085_Xr929gQImWPbJaORKesJKL5ziHmOCjCz0nJptVXi35arWSRU3rzS3ldS2zjG5lLaQQxJtsWa2aNMleJdnd9LwTwg5ydulbmhxKK8aOjOdeWcO4Z633vUuKuyR_wE_rQ5faYY8mZjq8fiPvYeTJ8wH40tZ3Osl30WCnjOrGjg3056gGQPXWatFyZVhjh2mbwf_owvO9ciPX7MmPUlmE8puOHDtgy1W6TtkV8qN6Vj1JxYPXnyxhmD-Q662R7rzbZZXma3agwYWN2iZ2zut3SX6PH5Z1vdI0pOwdBs9zlXEe2cV-wsJx3gjruGiVIRegB-ObNK-qZZlmAdiUR9faMWSfGEfi-96GkF1iuPafst_tkTA8WSADyiAlnrref8sT5du4A0NHkImDVJIlK_h-6GnoQEx1oBt0MIepoo0Wie3JA7c5MRoGOzjmVKc0H84xaqzW9ohAh_xP1IHJ6Rc_d2Gg3LlB4Dn2zg_EOzQDTT4KTdx83CuPDqE5rJQ7ZYQeJb305A_33CmB9xM3yqsviEUqqUnyze0SIPGv4GPCx3b5sljGz8898hmjJpVkxnpGB65H7ilg58hcSJLxLCnvfwby8tTcvH26vfmDgNgFcIGo7gK2VjWeE9RyZ-tPaRyJHelBAI39lJSv_uWgdAgB3xML7SAfI_TkyN2FMAjwNPBqNFgOckrWjEbEo41wWkMxdJLgN5zPJF_HwIXwov2_CZ4jggiFL8QqBCFaApDi7sXIG-6ep65a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