<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] __declspec(selectany) not handled correctly for extern "C" symbols"
   href="https://llvm.org/bugs/show_bug.cgi?id=23242">23242</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[ms] __declspec(selectany) not handled correctly for extern "C" symbols
          </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>nicolasweber@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>This compiles and links with both cl and clang-cl:

__declspec(selectany) int ChromeEnableBits[1];
int main() { return ChromeEnableBits[0]; }

This compiles and links fine with cl:

extern "C" __declspec(selectany) int ChromeEnableBits[1];
int main() { return ChromeEnableBits[0]; }

With clang-cl:

D:\src\llvm-ninja-rel64>bin\clang-cl foo.cc
foo-ac216e.obj : error LNK2019: unresolved external symbol ChromeEnableBits
referenced in function main
foo.exe : fatal error LNK1120: 1 unresolved externals
clang-cl.exe: error: linker command failed with exit code 1120 (use -v to see
invocation)

Code like this is created by mc.exe, msvs's message compiler. So it's important
to match cl.exe here.</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>