[LLVMbugs] [Bug 19786] New: Attributes on template class member function definitions are silently ignored after instantiation of class

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun May 18 08:57:25 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19786

            Bug ID: 19786
           Summary: Attributes on template class member function
                    definitions are silently ignored after instantiation
                    of class
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: st at quanttec.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

When the following test case is compiled with clang, the noinline attribute on
the "m" definition is silently ignored during the code generation for
Test<int>::m. 

If one moves the definition of f below Test<T>::m or instantiates Test in f
with a different type than int, the noinline attribute on Test<int>::m is
properly honoured.

noinline is just an example, of course. The same thing happens e.g. with the
no_sanitize_address attribute.

GCC also seems to have this issue.

template <typename T>
struct Test {
  void m();
};

void f() {
  Test<int> t;
}

void e();

template <typename T>
__attribute__((noinline))
void Test<T>::m() { 
  e();
}

void test(Test<int> t) {
  t.m();
}

-- 
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/20140518/82e32efe/attachment.html>


More information about the llvm-bugs mailing list