aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/devirtualize-vtable-marking.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/devirtualize-vtable-marking.cpp')
-rw-r--r--test/SemaCXX/devirtualize-vtable-marking.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/test/SemaCXX/devirtualize-vtable-marking.cpp b/test/SemaCXX/devirtualize-vtable-marking.cpp
index fc3e8ce7704c..1b32182c4f2e 100644
--- a/test/SemaCXX/devirtualize-vtable-marking.cpp
+++ b/test/SemaCXX/devirtualize-vtable-marking.cpp
@@ -1,29 +1,32 @@
// RUN: %clang_cc1 -verify -std=c++11 %s
-
+// expected-no-diagnostics
template <typename T> struct OwnPtr {
T *p;
~OwnPtr() {
- // expected-error@+1 {{invalid application of 'sizeof'}}
static_assert(sizeof(T) > 0, "incomplete T");
delete p;
}
};
namespace use_vtable_for_vcall {
-struct Incomplete; // expected-note {{forward declaration}}
+struct Incomplete;
struct A {
virtual ~A() {}
virtual void m() {}
};
-struct B : A { // expected-note {{in instantiation}}
+struct B : A {
B();
virtual void m() { }
virtual void m2() { static_cast<A *>(this)->m(); }
OwnPtr<Incomplete> m_sqlError;
};
-B *f() {
- return new B();
+void f() {
+ // Since B's constructor is declared out of line, nothing in this file
+ // references a vtable, so the destructor doesn't get built.
+ A *b = new B();
+ b->m();
+ delete b;
}
}