<html>
    <head>
      <base href="http://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 --- - Function macro expansion with return cast problem"
   href="http://llvm.org/bugs/show_bug.cgi?id=20050">20050</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Function macro expansion with return cast problem
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.4
          </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>paul.tankard@sumo-digital.com
          </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>Possibly Windows only (don't have different machine to test)

clang version 3.4.1 (207424)
Target: i686-pc-mingw32
Thread model: posix

In visual studio, cpp file is including interlockedapi.h which has the
following definition.

#define InterlockedExchangePointer(Target, Value) \
    (PVOID)InterlockedExchange((PLONG)(Target), ((LONG)(LONG_PTR)(Value)))

When invoked in code via

return ::InterlockedExchangePointer(Dest, Exchange);

The following is produced.

error : unexpected parenthesis after '::'
1>                  return ::InterlockedExchangePointer(Dest, Exchange);
1>                           ^
1>  C:\Program Files (x86)\Windows Kits\8.0\include\um\interlockedapi.h(76,4) :
 note: expanded from macro 'InterlockedExchangePointer'
1>      (PVOID)InterlockedExchange((PLONG)(Target), ((LONG)(LONG_PTR)(Value)))

error : expected '(' for function-style cast or type construction
1>                  return ::InterlockedExchangePointer(Dest, Exchange);
1>                         ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1>  C:\Program Files (x86)\Windows Kits\8.0\include\um\interlockedapi.h(76,11)
:  note: expanded from macro 'InterlockedExchangePointer'
1>      (PVOID)InterlockedExchange((PLONG)(Target), ((LONG)(LONG_PTR)(Value)))</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>