[llvm-bugs] [Bug 31826] New: Clang sometimes does not properly link classes inherited from dllimported classes
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jan 31 11:18:43 PST 2017
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: unassignedclangbugs at nondot.org
Reporter: marc at groundctl.com
CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170131/bcf9557f/attachment.html>
More information about the llvm-bugs
mailing list