<div dir="ltr">Hans would know for sure, but I think this is intentional: Since AClass is dllexported, all its implicit functions get generated (so that they can be exported from the dll), which means they need to be semantically checked. If you give the class a deleted copy constructor and assignment operator, it might work.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 13, 2015 at 8:07 PM, Edward Diener <span dir="ltr"><<a href="mailto:eldlistmailingz@tropicsoft.com" target="_blank">eldlistmailingz@tropicsoft.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I am compiling code with "-c -x c++ -O0 -g -fno-inline -Wall -g"<br>
using clang targeting mingw/gcc on Windows.<br>
<br>
This code compiles with no errors ( boost::scoped_ptr<T> is non-copyable, non-assignable ):<br>
<br>
#include <boost/scoped_ptr.hpp><br>
class<br>
AClass { boost::scoped_ptr<int> sp_pointer; };<br>
int main()  {  return 0;  }<br>
<br>
This code compiles with no errors:<br>
<br>
#include <boost/scoped_ptr.hpp><br>
class __attribute__((__visibility__(<u></u>"default")))<br>
AClass { boost::scoped_ptr<int> sp_pointer; };<br>
int main()  {  return 0;  }<br>
<br>
but this code compiles with errors:<br>
<br>
#include <boost/scoped_ptr.hpp><br>
class __attribute__((dllexport))<br>
AClass { boost::scoped_ptr<int> sp_pointer; };<br>
int main()  {  return 0;  }<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
test_clang_bug.cpp:3:1: error: field of type 'boost::scoped_ptr<int>' has private copy constructor<br>
AClass { boost::scoped_ptr<int> sp_pointer; };<br>
^<br>
..\..\..\boost/smart_ptr/<u></u>scoped_ptr.hpp:47:5: note: declared private here<br>
    scoped_ptr(scoped_ptr const &);<br>
    ^<br>
test_clang_bug.cpp:3:1: note: implicit copy constructor for 'AClass' first required here<br>
AClass { boost::scoped_ptr<int> sp_pointer; };<br>
^<br>
test_clang_bug.cpp:3:1: error: 'operator=' is a private member of 'boost::scoped_ptr<int>'<br>
AClass { boost::scoped_ptr<int> sp_pointer; };<br>
^<br>
..\..\..\boost/smart_ptr/<u></u>scoped_ptr.hpp:48:18: note: declared private here<br>
    scoped_ptr & operator=(scoped_ptr const &);<br>
                 ^<br>
test_clang_bug.cpp:3:1: note: implicit copy assignment operator for 'AClass' first required here<br>
AClass { boost::scoped_ptr<int> sp_pointer; };<br>
^<br>
2 errors generated.<br>
</blockquote>
<br>
Comments ?<br>
<br>
Should I file a bug report ?<br>
<br>
I do not see why, even "exporting" a class, clang should give an error. If I am not copying/assigning an instance of a class I should never get a compiler error telling me that some member is not copyable or assignable.<br>
<br>
______________________________<u></u>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>