<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 --- - clang-cl -fmsc-version=1900 produces .obj files that don't link"
   href="https://llvm.org/bugs/show_bug.cgi?id=26506">26506</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang-cl -fmsc-version=1900 produces .obj files that don't link
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>LLVM Codegen
          </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>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>C:\src\chrome\src>type dll.cc
struct A;
struct __declspec(dllexport) Base {
  virtual ~Base() {}
  virtual void operator()(const A&) const = 0;
};

struct __declspec(dllexport) Sub : public Base {
  void operator()(const A&) const override {};
};

C:\src\chrome\src>"third_party\llvm-build\Release+Asserts\bin\clang-cl.exe" /c
client.cc -fmsc-version=1900

C:\src\chrome\src>link /dll dll.obj
Microsoft (R) Incremental Linker Version 14.00.23506.0
Copyright (C) Microsoft Corporation.  All rights reserved.

   Creating library dll.lib and object dll.exp

C:\src\chrome\src>type client.cc
struct A;
struct __declspec(dllimport) Base {
  virtual ~Base() {}
  virtual void operator()(const A&) const = 0;
};

struct __declspec(dllimport) Sub : public Base {
  void operator()(const A&) const override {};
};

void f(Base* f) {
  static Sub s;
}

int main() {
}

C:\src\chrome\src>"third_party\llvm-build\Release+Asserts\bin\clang-cl.exe" /c
client.cc -fmsc-version=1900

C:\src\chrome\src>link client.obj dll.lib
Microsoft (R) Incremental Linker Version 14.00.23506.0
Copyright (C) Microsoft Corporation.  All rights reserved.

client.obj : error LNK2001: unresolved external symbol "const Sub::`vftable'"
(??_7Sub@@6B@)
client.exe : fatal error LNK1120: 1 unresolved externals


Works fine if I use -fmsc-version=1800 for the second compilation, or if I use
cl.exe.

If I use lld-link.exe for linking, it errors out with the same error.</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>