[LLVMbugs] [Bug 17480] New: __attribute__((used)) ignored in templated classes
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Oct 4 15:04:22 PDT 2013
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: unassignedclangbugs at nondot.org
Reporter: llvm at meinersbur.de
CC: llvmbugs at cs.uiuc.edu
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131004/1cdb7061/attachment.html>
More information about the llvm-bugs
mailing list