aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/warn-weak-vtables.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/warn-weak-vtables.cpp')
-rw-r--r--test/SemaCXX/warn-weak-vtables.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/SemaCXX/warn-weak-vtables.cpp b/test/SemaCXX/warn-weak-vtables.cpp
new file mode 100644
index 000000000000..1ea88a548e71
--- /dev/null
+++ b/test/SemaCXX/warn-weak-vtables.cpp
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify -Wweak-vtables
+
+struct A { // expected-warning {{'A' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit}}
+ virtual void f() { }
+};
+
+template<typename T> struct B {
+ virtual void f() { }
+};
+
+namespace {
+ struct C {
+ virtual void f() { }
+ };
+}
+
+void f() {
+ struct A {
+ virtual void f() { }
+ };
+} \ No newline at end of file