[llvm-bugs] [Bug 32191] New: clang not exporting inline move constructor and assignment operator

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 8 23:36:51 PST 2017


            Bug ID: 32191
           Summary: clang not exporting inline move constructor and
                    assignment operator
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: smeenai at fb.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

% 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

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).

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170309/9915f135/attachment.html>

More information about the llvm-bugs mailing list