- Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
Labels
clang:codegenIR generation bugs: mangling, exceptions, etc.IR generation bugs: mangling, exceptions, etc.
Description
Consider:
C:\src\llvm-project>cat \src\temp\a.cc template <typename> struct Fruit { __attribute((exclude_from_explicit_instantiation)) Fruit() {} virtual void __attribute((exclude_from_explicit_instantiation)) draw() {} }; extern template struct Fruit<int>; int main() { Fruit<int> f; return 0; } C:\src\llvm-project>build\bin\clang-cl \src\temp\a.cc -fuse-ld=lld lld-link: error: undefined symbol: public: virtual void __cdecl Fruit<int>::draw(void) >>> referenced by c:\src\temp\a-6ec007.obj:(const Fruit<int>::`vftable') clang-cl: error: linker command failed with exit code 1 (use -v to see invocation) It seems that despite the exclude_from_explicit_instantiation attribute on Fruit<>::draw, the explicit instantiation decl prevents the definition from being emitted when referenced by the vtable. Instead the definition of Fruit<>::draw will only get emitted once there's an explicit instantiation definition.
However, after 84216d1 that stopped working across DLL boundaries, since the method will no longer be dllimport/export.
It seems the exclusion from explicit instantiation is not working completely.
Metadata
Metadata
Assignees
Labels
clang:codegenIR generation bugs: mangling, exceptions, etc.IR generation bugs: mangling, exceptions, etc.