<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 not exporting inline move constructor and assignment operator"
   href="https://bugs.llvm.org/show_bug.cgi?id=32191">32191</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang not exporting inline move constructor and assignment operator
          </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>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>smeenai@fb.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>% cat reduced.cpp
struct __declspec(dllexport) s {
  s(s &&other) {}
  s &operator=(s &&rhs) { return *this; }
};

% clang++ -target i686-windows -std=c++11 -c reduced.cpp
% llvm-readobj -coff-directives reduced.o

File: reduced.o
Format: COFF-i386
Arch: i386
AddressSize: 32bit

To contrast with cl

% cl /c reduced.cpp
% dumpbin /directives reduced.obj
--snip--
   -----------------
   /EXPORT:??0s@@QAE@$$QAU0@@Z
   /EXPORT:??4s@@QAEAAU0@$$QAU0@@Z

There are two (probably related) issues here. The __declspec(dllexport) should
force an out-of-line copy of all inline members to be emitted, and this copy
should be marked dllexport. Neither of those is occurring here.

Interestingly, moving the definitions out of line behaves correctly, even if
the out-of-line definitions are marked inline.

This seems to be specific to the move constructor and assignment operator. The
copy constructor and assignment operator behave as expected (i.e. definitions
in the class body get exported).</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>