<html>
<head>
<base href="https://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 --- - -Wunneeded-member-function for dtor of trivially destructible class with internal linkage"
href="https://llvm.org/bugs/show_bug.cgi?id=28817">28817</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>-Wunneeded-member-function for dtor of trivially destructible class with internal linkage
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.8
</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>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>bloerwald@googlemail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=16862" name="attach_16862" title="reproducing source as file">attachment 16862</a> <a href="attachment.cgi?id=16862&action=edit" title="reproducing source as file">[details]</a></span>
reproducing source as file
When defining a class with a trivial, defaulted dtor,
-Wunneeded-member-function is emitted even when explicitly calling the dtor. If
adding a non-trivially destructible member (e.g. std::string), the warning is
no longer emitted:
#include <string> // for non-trival member
namespace {
struct F {
~F() = default;
#ifdef MEMBER
MEMBER x;
#endif
};
}
void f()
{
F{}.~F();
}
$ clang++ -UMEMBER -Wunneeded-member-function -c tmp.cpp -o/dev/null
--std=c++11
tmp.cpp:5:7: warning: member function '~F' is not needed and will not be
emitted [-Wunneeded-member-function]
~F() = default;
^
1 warning generated.
$ clang++ -DMEMBER=int -Wunneeded-member-function -c tmp.cpp -o/dev/null
--std=c++11
tmp.cpp:5:7: warning: member function '~F' is not needed and will not be
emitted [-Wunneeded-member-function]
~F() = default;
^
1 warning generated.
$ clang++ -DMEMBER=std::string -Wunneeded-member-function -c tmp.cpp
-o/dev/null --std=c++11
$</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>