[LLVMbugs] [Bug 20163] New: clang-cl tries to instantiate all of the methods on template dllexport classes

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 30 09:11:27 PDT 2014


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

            Bug ID: 20163
           Summary: clang-cl tries to instantiate all of the methods on
                    template dllexport classes
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ehsan at mozilla.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

We hit this when building Skia as a DLL with clang-cl.  FWIW I think the
semantics implemented by clang-cl is much saner, but I guess MSVC only exports
the symbols that are used in the translation unit and doesn't try to
instantiate all of the other members.

$ cat test.cpp
template <class T> struct __declspec(dllexport) Foo {
  void f() { T::bar(); }
};
void x() {
  Foo<int> a;
}

$ cl -c test.cpp

$ clang-cl -c test.cpp
test.cpp(2,14) :  error: type 'int' cannot be used prior to '::' because it has
no members
  void f() { T::bar(); }
             ^
test.cpp(1,49) :  note: in instantiation of member function 'Foo<int>::f'
requested here
template <class T> struct __declspec(dllexport) Foo {
                                                ^
1 error generated.

-- 
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/20140630/e6cd5dc9/attachment.html>


More information about the llvm-bugs mailing list