[LLVMbugs] [Bug 10272] New: attribute in method in template class doesn't survive instantiation
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Jul 4 21:55:22 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=10272
Summary: attribute in method in template class doesn't survive
instantiation
Product: clang
Version: unspecified
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: rafael.espindola at gmail.com
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
Given:
template <class Ty> struct Vector {
void growStorageBy();
};
template <class T> __attribute__((noinline)) void Vector<T>::growStorageBy() {
}
void foo() {
Vector<int> strs;
strs.growStorageBy();
}
clang produces:
define linkonce_odr void @_ZN6VectorIiE13growStorageByEv(%struct.Vector* %this)
nounwind align 2 {
Note that the noinline is missing.
Adding
for (DeclContext::decl_iterator I = Tmpl->getDeclContext()->decls_begin(),
E = Tmpl->getDeclContext()->decls_end(); I != E; ++I) {
Decl *D = *I;
for (AttrVec::const_iterator i = D->attr_begin(), e = D->attr_end();
i != e; ++i) {
const Attr *TmplAttr = *i;
if (TmplAttr->getKind() == clang::attr::NoInline) {
assert(0 && "foo");
}
}
}
to Sema::InstantiateAttrs hits the assert, so the attribute is available in a
redeclaration. Now, I don't know if the attribute should have been merged at
this point or if Sema::InstantiateAttrs should walk redeclations.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list