mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-19 11:35:51 -04:00

If a header contains 'extern template', then the template should be provided somewhere by an explicit instantiation, so it is not necessary to generate a copy. Worse, this can lead to an unresolved symbol, because the codegen's object file will not actually contain functions from such a template because of the GVA_AvailableExternally, but the object file for the explicit instantiation will not contain them either because it will be blocked by the information provided by the module. Differential Revision: https://reviews.llvm.org/D69779
13 lines
245 B
C++
13 lines
245 B
C++
// header for codegen-extern-template.cpp
|
|
#ifndef CODEGEN_EXTERN_TEMPLATE_H
|
|
#define CODEGEN_EXTERN_TEMPLATE_H
|
|
|
|
template <typename T>
|
|
inline T foo() { return 10; }
|
|
|
|
extern template int foo<int>();
|
|
|
|
inline int bar() { return foo<int>(); }
|
|
|
|
#endif
|