<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Clang 7.0.0 RC1 -fno-ms-compatibility rejects Windows.h"
   href="https://bugs.llvm.org/show_bug.cgi?id=38478">38478</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang 7.0.0 RC1 -fno-ms-compatibility rejects Windows.h
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>sfinae@hotmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I use -fno-ms-compatibility to verify that MSVC's STL uses conformant code
whenever possible. Between Clang 6.0.0 and 7.0.0 RC1, this started rejecting
Windows.h due to nonconformant enumerators:

C:\Temp>type kitty.cpp
#include <Windows.h>

C:\Temp>clang-cl -m32 -v
clang version 7.0.0 (tags/RELEASE_700/rc1)
Target: i386-pc-windows-msvc
Thread model: posix
InstalledDir: S:\msvc\src\vctools\NonShip\ClangLLVM\bin

C:\Temp>clang-cl -m32 /EHsc /nologo /W4 /c -fno-ms-compatibility kitty.cpp
In file included from kitty.cpp:1:
In file included from
S:\msvc\src\ExternalApis\Windows\10\sdk\inc\Windows.h:173:
S:\msvc\src\ExternalApis\Windows\10\sdk\inc\wingdi.h(2819,5):  error:
enumerator value is not representable in the
      underlying type 'int'
    DISPLAYCONFIG_OUTPUT_TECHNOLOGY_INTERNAL                = 0x80000000,
    ^
[...]

I've reported this to the WinSDK team, but I still need to unblock my testing
in the meantime. Can some way be added to request the strictness of
-fno-ms-compatibility, but without rejecting Windows.h like this?

Possibilities:

* A fine-grained option, so I could compile with -fno-ms-compatibility
-fms-compatibility-enum-value to request strictness for everything except these
enum values. 

* I observe that -Wmicrosoft contains the fine-grained warning
-Wmicrosoft-enum-value for this case. Instead of introducing a new fine-grained
option, if -fno-ms-compatibility -Wno-microsoft-enum-value avoided this error,
that would be equally good for me. Perhaps better, because then I could wrap
Windows.h in

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmicrosoft-enum-value"
#pragma clang diagnostic pop

and retain the enum strictness for the rest of our code.

* Go back to doing whatever Clang 6 did, which was presumably to consider this
enum behavior part of ms-extensions instead of ms-compatibility (but allowing
-Wmicrosoft to warn about it).</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>