<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 --- - Improve diagnostic when a destructor is implicitly deleted due to private operator delete"
href="http://llvm.org/bugs/show_bug.cgi?id=15783">15783</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Improve diagnostic when a destructor is implicitly deleted due to private operator delete
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nicolasweber@gmx.de
</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>template <typename Type> class IsInstrumented {
class yes { char m; };
class no { yes m[2]; };
struct BaseMixin {
void reportMemoryUsage() const {}
};
struct Base : public Type, public BaseMixin {
};
template <typename T, T t> class Helper {
};
template <typename U>
static no
deduce(U *, Helper<void(BaseMixin::*)() const, &U::reportMemoryUsage> * = 0);
static yes deduce(...);
public:
static const bool result = sizeof(yes) == sizeof(deduce((Base *)(0)));
};
template <typename T> bool hasReportMemoryUsage(const T *object) {
return IsInstrumented<T>::result;
}
class Timer {
void operator delete(void *p) {}
public:
virtual ~Timer();
};
bool f() {
Timer m_cacheTimer;
return hasReportMemoryUsage(&m_cacheTimer);
}
The error message from r178563 looks like this:
$ third_party/llvm-build/Release+Asserts/bin/clang -c repro.ii -std=gnu++11
repro.ii:7:10: error: deleted function '~Base' cannot override a non-deleted
function
struct Base : public Type, public BaseMixin {
^
repro.ii:13:51: note: in instantiation of member class
'IsInstrumented<Timer>::Base' requested here
deduce(U *, Helper<void(BaseMixin::*)() const, &U::reportMemoryUsage> * = 0);
^
repro.ii:13:3: note: while substituting deduced template arguments into
function template 'deduce' [with U = IsInstrumented<Timer>::Base]
deduce(U *, Helper<void(BaseMixin::*)() const, &U::reportMemoryUsage> * = 0);
^
repro.ii:20:10: note: in instantiation of template class
'IsInstrumented<Timer>' requested here
return IsInstrumented<T>::result;
^
repro.ii:30:10: note: in instantiation of function template specialization
'hasReportMemoryUsage<Timer>' requested here
return hasReportMemoryUsage(&m_cacheTimer);
^
repro.ii:26:11: note: overridden virtual function is here
virtual ~Timer();
^
1 error generated.
Says Richard: """Yes, the diagnostic seems to be correct, if unhelpful. Feel
free to file a bug on the diagnostic (if not, I'll try to remember to fix this
but can't promise!). We should be pointing out that the function is implicitly
deleted because it would otherwise try to call an inaccessible class-specific
'operator delete'."""</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>