[LLVMbugs] [Bug 22591] New: Compilation of exported class gives errors when class is not copyable and/or copy-assignable

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Feb 14 18:12:06 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22591

            Bug ID: 22591
           Summary: Compilation of exported class gives errors when class
                    is not copyable and/or copy-assignable
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eldlistmailingz at tropicsoft.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Compiling the latest clang built from trunk on Windows targeting mingw/gcc with
options '-c -x c++ -O0 -g -fno-inline -Wall -g':

#include <boost/scoped_ptr.hpp>
class __attribute__((dllexport)) 
AClass { boost::scoped_ptr<int> sp_pointer; };
int main()  {  return 0;  }

gives:

'test_clang_bug.cpp:3:1: error: field of type 'boost::scoped_ptr<int>' has
private copy constructor
AClass { boost::scoped_ptr<int> sp_pointer; };
^
..\..\..\boost/smart_ptr/scoped_ptr.hpp:47:5: note: declared private here
    scoped_ptr(scoped_ptr const &);
    ^
test_clang_bug.cpp:3:1: note: implicit copy constructor for 'AClass' first
required here
AClass { boost::scoped_ptr<int> sp_pointer; };
^
test_clang_bug.cpp:3:1: error: 'operator=' is a private member of
'boost::scoped_ptr<int>'
AClass { boost::scoped_ptr<int> sp_pointer; };
^
..\..\..\boost/smart_ptr/scoped_ptr.hpp:48:18: note: declared private here
    scoped_ptr & operator=(scoped_ptr const &);
                 ^
test_clang_bug.cpp:3:1: note: implicit copy assignment operator for 'AClass'
first required here
AClass { boost::scoped_ptr<int> sp_pointer; };
^
2 errors generated.'

The class boost::scoped_ptr<T> is non-copyable and non-assignable.

Compiling the exact same code with mingw/mingw64/gcc and compiling the same
code with VC++12 using '__declspec(dllexport)' as the export keyword gives no
errors.

This issue has been discussed on the clang developer's list and I have been
asked to file a bug report for this issue.

The problem with a more complicated class occurs in Boost libraries where a
class with a non-copyable, non-assignable member and without any user-defined
copy constructor or copy-assignment operator is being exported and clang on
Windows targeting mingw/gcc is the compiler. I would also suspect that clang-cl
has the same problem although I have not tested it.

-- 
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/20150215/f0bdbd60/attachment.html>


More information about the llvm-bugs mailing list