[LLVMbugs] [Bug 15783] New: Improve diagnostic when a destructor is implicitly deleted due to private operator delete
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Apr 18 10:47:51 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=15783
Bug ID: 15783
Summary: Improve diagnostic when a destructor is implicitly
deleted due to private operator delete
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: nicolasweber at gmx.de
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
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'."""
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130418/5c42e960/attachment.html>
More information about the llvm-bugs
mailing list