Skip to content

clang accepts new dll attributes on explicit instantiation of already instantiated templates #21132

@zmodem

Description

@zmodem
Bugzilla Link 20758
Version unspecified
OS Windows NT
CC @DougGregor

Extended Description

Consider:

template <typename T> void f() {}
void foo() { f<int>(); }
template void __declspec(dllimport) f<int>();

or

template <typename T> struct S { void f() {} };
void bar(S<int> s) { s.f(); }
template struct __declspec(dllexport) S<int>; 

Clang accepts the code, but the attribute doesn't have any effect since it's applied too late.

I think this would be hard for us to handle, so we should warn and drop the attribute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions