https://bugs.llvm.org/show_bug.cgi?id=32191

            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: unassignedclangb...@nondot.org
          Reporter: smee...@fb.com
                CC: dgre...@apple.com, llvm-bugs@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
--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).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to