<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 --- - Crash when explicitly instantiating a class template with a protected defaulted dtor, after a use of that dtor"
   href="http://llvm.org/bugs/show_bug.cgi?id=22793">22793</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash when explicitly instantiating a class template with a protected defaulted dtor, after a use of that dtor
          </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>Linux
          </td>
        </tr>

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

        <tr>
          <th>Keywords</th>
          <td>compile-fail
          </td>
        </tr>

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

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

        <tr>
          <th>Component</th>
          <td>C++11
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dblaikie@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The most basic repro I can come up with is:

  template <typename>
  struct foo {
  protected:
    ~foo() = default;
    friend void func();
  };

  void func() { foo<int> f; }

  template struct foo<int>;

(including an explicit instantiation declaration before the definition of
'func' doesn't help, FWIW)

Other ways to call ~foo<int> still produce the problem - eg: deriving from
foo<int> and having a user-defined dtor or ctor, even if they're never called.

Making the dtor public instead of protected avoids the crash

Defining the dtor as {} instead of "= default" avoids the crash.

This came up in a Clang self-host (reported as PR22791, among other instances).</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>