https://llvm.org/bugs/show_bug.cgi?id=31826

            Bug ID: 31826
           Summary: Clang sometimes does not properly link classes
                    inherited from dllimported classes
           Product: clang
           Version: 3.9
          Hardware: PC
                OS: other
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: m...@groundctl.com
                CC: llvm-bugs@lists.llvm.org
    Classification: Unclassified

Code is as follows:

==> x.cpp <==
#define DECL __declspec(dllexport)
#include "header.h"

==> y.cpp <==
#define DECL __declspec(dllimport)
#include "header.h"
int main() {
        t2 s;
}

==> header.h <==
struct DECL t {
        virtual void fun() = 0;
};
struct t2 : t {
        virtual void fun() {}
};

When using mingw64 6.2, if x.cpp is compiled as x.dll and y.cpp is compiled as
an executable linking x.dll, the linker fails with undefined references to
`_imp___ZTV1t' and `typeinfo for t'.  This code works fine with both gcc 6.2
and Visual Studio 2015.

Adding a virtual function to t defined in x.cpp causes this issue to go away.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to