[LLVMbugs] [Bug 21399] New: Don't dllexport vftable in anonymous classes

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Oct 27 17:38:50 PDT 2014


            Bug ID: 21399
           Summary: Don't dllexport vftable in anonymous classes
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hans at chromium.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


  namespace {
    struct __declspec(dllexport) S {
      virtual void foo();

  void __declspec(dllexport) f() {
    S s;

bin\clang-cl /LD d:\src\tmp\a.cc
   Creating library a.lib and object a.exp
a-755166.obj : error LNK2001: unresolved external symbol "public: virtual void
_thiscall `anonymous namespace'::S::foo(void)" (?foo at S@?A@@UAEXXZ)
a.exp : error LNK2001: unresolved external symbol "const `anonymous
S::`vftable'" (??_7S@?A@@6B@)
a.dll : fatal error LNK1120: 2 unresolved externals
clang-cl.exe: error: linker command failed with exit code 1120 (use -v to see

We should not try to export the vftable here. We should also warn the user that
exporting things in the anonymous namespace doesn't make sense (and for
dllimport maybe we should error?)

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/20141028/92b6d690/attachment.html>

More information about the llvm-bugs mailing list