<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 --- - IR linking and COMDAT constraints"
   href="https://llvm.org/bugs/show_bug.cgi?id=24847">24847</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>IR linking and COMDAT constraints
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.7
          </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>Linker
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>russell.wallace@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14888" name="attach_14888" title="The linked .ll file">attachment 14888</a> <a href="attachment.cgi?id=14888&action=edit" title="The linked .ll file">[details]</a></span>
The linked .ll file

When I use clang on Windows to compile a program using regular expressions to
intermediate code, then run the result through llvm-link and finally try to
generate an executable, I get an error.

All of these ingredients are necessary; it works if the program doesn't use
regular expressions, and it works if I compile it directly instead of going via
intermediate code. 

The use of the exact llvm-link binary, however, is not a necessary ingredient;
I get the same result with a linking program of my own that uses the same
libraries as llvm-link.

Minimal test case:

C:\test>type test.cpp
#include <regex>

int main() {
  std::cmatch m;
  regex_match("a", m, std::regex("a"));
  return 0;
}

C:\test>clang-cl -Xclang -emit-llvm -c -fms-compatibility-version=19 test.cpp

C:\test>move test.obj test.ll
Overwrite C:\test\test.ll? (Yes/No/All): y
        1 file(s) moved.

C:\test>llvm-link test.ll -o=a.ll

C:\test>clang-cl -Wno-override-module a.ll
a-e22d14.obj : fatal error LNK1243: invalid or corrupt file: COMDAT section
0x373 associated with following section 0x389
clang-cl.exe: error: linker command failed with exit code 1243 (use -v to see
invocation)</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>