<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - MS-compatibility: XAudio2.h fails to compile due to spaces in GUID"
   href="https://llvm.org/bugs/show_bug.cgi?id=23071">23071</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>MS-compatibility: XAudio2.h fails to compile due to spaces in GUID
          </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>All
          </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>Frontend
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jonathan.sauer@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following code (excerpted from Microsoft's DirectX header XAudio2.h) fails
to compile with Windows compatibility:

#define DECLSPEC_UUID_WRAPPER(x) __declspec(uuid(#x))

#define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
  class
DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8)
className

DEFINE_CLSID(XAudio2, 5a508685, a254, 4fba, 9b, 82, 9a, 24, b0, 03, 06, af);
//DEFINE_CLSID(XAudio2,5a508685,a254,4fba,9b,82,9a,24,b0,03,06,af);


This results in: 

% clang++ -fms-extensions -Wno-invalid-token-paste -c clang.cpp 
clang.cpp:6:1: error: uuid attribute contains a malformed GUID
DEFINE_CLSID(XAudio2, 5a508685, a254, 4fba, 9b, 82, 9a, 24, b0, 03, 06, af);
^
clang.cpp:4:8: note: expanded from macro 'DEFINE_CLSID'
        class
DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8)
className
              ^
clang.cpp:1:50: note: expanded from macro 'DECLSPEC_UUID_WRAPPER'
#define DECLSPEC_UUID_WRAPPER(x) __declspec(uuid(#x))
                                                 ^
<scratch space>:16:1: note: expanded from here
"5a508685- a254- 4fba- 9b82- 9a24b00306af"
^
1 error generated.


When using the commented DEFINE_CLSID-line without the spaces, the code
compiles successfully.</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>