summaryrefslogtreecommitdiff
path: root/test/SemaCXX/warn-weak-vtables.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2011-10-20 21:14:49 +0000
committerDimitry Andric <dim@FreeBSD.org>2011-10-20 21:14:49 +0000
commit36981b17ed939300f6f8fc2355a255f711fcef71 (patch)
treeee2483e98b09cac943dc93a6969d83ca737ff139 /test/SemaCXX/warn-weak-vtables.cpp
parent180abc3db9ae3b4fc63cd65b15697e6ffcc8a657 (diff)
Notes
Diffstat (limited to 'test/SemaCXX/warn-weak-vtables.cpp')
-rw-r--r--test/SemaCXX/warn-weak-vtables.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/SemaCXX/warn-weak-vtables.cpp b/test/SemaCXX/warn-weak-vtables.cpp
index c0cfd74a3e528..912622f5a7e43 100644
--- a/test/SemaCXX/warn-weak-vtables.cpp
+++ b/test/SemaCXX/warn-weak-vtables.cpp
@@ -29,3 +29,30 @@ void uses(A &a, B<int> &b, C &c) {
b.f();
c.f();
}
+
+// <rdar://problem/9979458>
+class Parent {
+public:
+ Parent() {}
+ virtual ~Parent();
+ virtual void * getFoo() const = 0;
+};
+
+class Derived : public Parent {
+public:
+ Derived();
+ void * getFoo() const;
+};
+
+class VeryDerived : public Derived { // expected-warning{{'VeryDerived' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit}}
+public:
+ void * getFoo() const { return 0; }
+};
+
+Parent::~Parent() {}
+
+void uses(Parent &p, Derived &d, VeryDerived &vd) {
+ p.getFoo();
+ d.getFoo();
+ vd.getFoo();
+}