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

            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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Consider:

  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@S@?A@@UAEXXZ)
a.exp : error LNK2001: unresolved external symbol "const `anonymous
namespace'::
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
in
vocation)


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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to