<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - [[gnu::used]] unsupported. Breaks many "inline static" use cases including P0424R0."
   href="https://bugs.llvm.org/show_bug.cgi?id=46059">46059</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[[gnu::used]] unsupported. Breaks many "inline static" use cases including P0424R0.
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>All
          </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>C++17
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dsim@smallscript.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>NEVER FIXED: <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Member functions of class templates not instantiated despite [[gnu::used]]"
   href="show_bug.cgi?id=19923">https://bugs.llvm.org/show_bug.cgi?id=19923</a>

Breaks patterns for creating self registering code modules; which happens to
also go hand in hand with pattern use cases for P0424R0/P0424R1.

Using "inline static" will not ensure the static variable is defined.

In fact, the compiler will analyze and remove the static if it thinks it is
unreachable.

This creates the need to do horrible things like declare static extern export
functions that reference the "inline static" to ensure it is not elided. Which
is total crap and pollution of the COFF/ELF/PE exports!

struct Base {
  inline static Base* pHead = nullptr;
  static void DoRuntimeActions() { 
    for(auto p = pHead; p; p = p->pPrev) p->onRuntimeAction();
  }
  Base* pPrev;
  Base() { pPrev = pHead; pHead = this; }
  virtual void onRuntimeAction() = 0;
}
struct Foo : Base {
  [[gnu::used]] /* NO SUPPORTED IN CLANG!!!! */
  inline static Foo s; // SO, no way to guarantee it will exist
  /* leverage static singleton registration pattern BROKEN */
  virtual void onRuntimeAction() { /* do something useful */ }
}</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>