forked from OSchip/llvm-project
Allow dllimport on function definitions when they're template instantiations
llvm-svn: 209157
This commit is contained in:
parent
dc92102766
commit
7f26fa6715
|
@ -9766,7 +9766,8 @@ Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D) {
|
|||
ResolveExceptionSpec(D->getLocation(), FPT);
|
||||
|
||||
// dllimport cannot be applied to non-inline function definitions.
|
||||
if (FD->hasAttr<DLLImportAttr>() && !FD->isInlined()) {
|
||||
if (FD->hasAttr<DLLImportAttr>() && !FD->isInlined() &&
|
||||
!FD->isTemplateInstantiation()) {
|
||||
assert(!FD->hasAttr<DLLExportAttr>());
|
||||
Diag(FD->getLocation(), diag::err_attribute_dllimport_function_definition);
|
||||
FD->setInvalidDecl();
|
||||
|
|
|
@ -8,7 +8,7 @@ void DLLIMPORT a();
|
|||
inline void DLLIMPORT b() {}
|
||||
// CHECK-DAG: define available_externally dllimport void @"\01?b@@YAXXZ"()
|
||||
|
||||
template <typename T> inline void c() {} // FIXME: MSVC accepts this without 'inline' too.
|
||||
template <typename T> void c() {}
|
||||
template void DLLIMPORT c<int>();
|
||||
// CHECK-DAG: define available_externally dllimport void @"\01??$c@H@@YAXXZ"()
|
||||
|
||||
|
|
Loading…
Reference in New Issue