-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
Description
Bugzilla Link | 28460 |
Resolution | FIXED |
Resolved on | Sep 02, 2017 12:47 |
Version | unspecified |
OS | Linux |
CC | @zetafunction,@DougGregor |
Extended Description
This warns, like it should:
thakis@thakis:~/src/chrome/src$ cat test.cc
#include <memory>
struct S {
virtual void f() {}
};
struct T : public S {
};
void f(S* s) {
delete s;
}
thakis@thakis:~/src/chrome/src$ third_party/llvm-build/Release+Asserts/bin/clang -c test.cc -Wall -std=c++11
test.cc:11:3: warning: delete called on non-final 'S' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
delete s;
^
1 warning generated.
But this doesn't:
thakis@thakis:~/src/chrome/src$ cat test.cc
#include <memory>
struct S {
virtual void f() {}
};
struct T : public S {
};
void f() {
std::unique_ptr<S> s;
}
thakis@thakis:~/src/chrome/src$ third_party/llvm-build/Release+Asserts/bin/clang -c test.cc -Wall -std=c++11
It should.