<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - function attributes on member function definitions are ignored after explicit template class declaration"
   href="http://llvm.org/bugs/show_bug.cgi?id=16976">16976</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>function attributes on member function definitions are ignored after explicit template class declaration
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>LLVM Codegen
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>st@quanttec.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When clang generates the code for an explicit template class instantiation it
ignores the attributes on member functions that are defined out-of-line after
the explicit instantiation declaration.

For example, when clang compiles the following code

  #include <stdlib.h>

  template <typename T>
  class Test {
  public:
    void inlinef();

    void noinlinef();
  };

  extern template struct Test<char>;

  template <typename T>
  __attribute__((always_inline)) 
  void Test<T>::inlinef() {}

  template <typename T>
  __attribute__((noinline)) 
  void Test<T>::noinlinef() {}

  template class Test<char>;

it generates the following IR for the two member functions 

  ; Function Attrs: nounwind readnone ssp uwtable
  define weak_odr void @_ZN4TestIcE7inlinefEv(%class.Test* nocapture %this) #0
align 2 {
  entry:
    ret void
  }

  ; Function Attrs: nounwind readnone ssp uwtable
  define weak_odr void @_ZN4TestIcE9noinlinefEv(%class.Test* nocapture %this)
#0 align 2 {
  entry:
    ret void
  }

If the attributes are moved to the member function declarations or if the
explicit instantiation declaration is moved to after the function definitions
(immediately before the explicit instantiation definition), the IR function
definitions get correctly annotated with the respective attributes.

This issue can lead to difficult to diagnose performance problems.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>