[llvm-bugs] [Bug 31695] New: Export attribute on inline template method not ignored
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jan 19 09:49:40 PST 2017
https://llvm.org/bugs/show_bug.cgi?id=31695
Bug ID: 31695
Summary: Export attribute on inline template method not ignored
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: Driver
Assignee: unassignedclangbugs at nondot.org
Reporter: steveire at gmail.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Given a header
#ifdef BUILDING_LIB
#define EXPORT __declspec(dllexport)
#else
#define EXPORT __declspec(dllimport)
#endif
namespace MyNS {
EXPORT void func();
template<int size = 3>
EXPORT inline int someFunc(int input = size);
}
template<int size>
int MyNS::someFunc(int input)
{
return input * 2;
}
and trivial source file:
#include "export-inline.h"
namespace MyNS {
void func()
{
}
}
and consumer:
#include "export-inline.h"
int main()
{
MyNS::func();
int sf = MyNS::someFunc(43);
return 0;
}
and buildsystem:
add_library(sh SHARED
export-inline.cpp
)
target_compile_definitions(sh PRIVATE BUILDING_LIB)
add_executable(shconsumer export-consumer.cpp)
target_link_libraries(shconsumer sh)
clang-cl fails to ignore the export attribute and the link fails.
unresolved external symbol "__declspec(dllimport) int __cdecl
MyNS::someFunc<3>(int)" (__imp_??$someFunc@$02 at MyNS@@YAHH at Z) referenced in
function main
--
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/20170119/087227e3/attachment.html>
More information about the llvm-bugs
mailing list