<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 - Wdelete-abstract-non-virtual-dtor incorrect message/fixit in template"
   href="https://bugs.llvm.org/show_bug.cgi?id=40894">40894</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Wdelete-abstract-non-virtual-dtor incorrect message/fixit in template
          </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>C++
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>--

struct Foo {
    virtual void bar() = 0;
};

template <typename T>
void destroy(T *t) {
    t->~T();
}

void destroyFoo(Foo *foo) {
    destroy(foo);
}


--

Clang produces:

<source>:7:5: warning: destructor called on 'Foo' that is abstract but has
non-virtual destructor [-Wdelete-abstract-non-virtual-dtor]
    t->~T();
    ^
<source>:11:5: note: in instantiation of function template specialization
'destroy<Foo>' requested here
    destroy(foo);
    ^
<source>:7:9: note: qualify call to silence this warning
    t->~T();
        ^
        Foo::

The fixit suggests inserting the concrete type name (Foo::) inside the template
function, which doesn't make sense.  Interestingly, inserting T:: doesn't work
either; it's invalid syntax for whatever reason.

I'm not sure what the warning should do in this case, but as is, the fixit is
incorrect, and it's apparently impossible to "qualify call to silence this
warning" as the note says.</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>