[LLVMbugs] [Bug 20782] New: dllexport instantiates all member functions of all member variables of a class

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 27 18:19:51 PDT 2014


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

            Bug ID: 20782
           Summary: dllexport instantiates all member functions of all
                    member variables of a class
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Consider:

template<class T>
class Vector {
  T* elt_;
public:
  void operator=(const Vector<T>& other) {
    *elt_ = *other.elt_;
  }
};

class BlobDataItem {
public:
  BlobDataItem() : a_(A) {}
  const enum { A } a_;
};

class __declspec(dllexport) BlobData {
  BlobData() {}
  Vector<BlobDataItem> elts;
};


Builds fine normally:

hummer:llvm-build thakis$ bin/clang -c test.cc -std=c++11
test.cc:16:18: warning: __declspec attribute 'dllexport' is not supported
[-Wignored-attributes]
class __declspec(dllexport) BlobData {
                 ^
1 warning generated.


Doesn't build with clang-cl:

hummer:llvm-build thakis$ bin/clang-cl -c test.cc 
test.cc(6,11) :  error: object of type 'BlobDataItem' cannot be assigned
because its copy assignment operator is implicitly deleted
    *elt_ = *other.elt_;
          ^
test.cc(16,29) :  note: in instantiation of member function
'Vector<BlobDataItem>::operator=' requested here
class __declspec(dllexport) BlobData {
                            ^
test.cc(13,20) :  note: copy assignment operator of 'BlobDataItem' is
implicitly deleted because field 'a_' is of const-qualified type 'const enum
(anonymous enum at test.cc:13:9)'
  const enum { A } a_;
                   ^
1 error generated.



That's because Vector::operator=() doesn't build, but as it's not used it
shouldn't matter.

-- 
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/20140828/3fef149b/attachment.html>


More information about the llvm-bugs mailing list