http://llvm.org/bugs/show_bug.cgi?id=17480
Bug ID: 17480
Summary: __attribute__((used)) ignored in templated classes
Product: clang
Version: trunk
Hardware: PC
OS: Windows XP
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
Test program test.cpp:
static __attribute__((used)) void Afunc() {}
class testclass2 {
__attribute__((used)) void Bfunc() {}
};
testclass2 xxx;
template<typename T>
class testclass3 {
__attribute__((used)) void Cfunc() {}
};
testclass3<int> yyy;
> clang test.cpp -c -o test.obj
> nm test.obj
00000000 b .bss
00000000 d .data
00000000 t .text
00000000 t .text$_ZN10testclass25BfuncEv
00000000 t __ZL5Afuncv
00000000 T __ZN10testclass25BfuncEv
00000000 B _xxx
00000001 B _yyy
I expected to see the mangled name of funcC ("__ZN10testclass25CfuncEv") as
well in the object file. Same result with explicit instantiation instead of
using it:
template class testclass3<int>;
The culprit seems to be in CodeGeneratorImpl::HandleTagDeclDefinition(). It
calls Method->doesThisDeclarationHaveABody(), but the body is not instantiated
until the end of the translation unit when Sema::PerformPendingInstantiations()
get called.
Using clang r191953 on Windows 7 targeting i686-pc-mingw32
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs