<html>
    <head>
      <base href="http://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 --- - Compilation of exported class gives errors when class is not copyable and/or copy-assignable"
   href="http://llvm.org/bugs/show_bug.cgi?id=22591">22591</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Compilation of exported class gives errors when class is not copyable and/or copy-assignable
          </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>Windows XP
          </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>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>eldlistmailingz@tropicsoft.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</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>