From 0da714a3e2168930c7ac186df37d6acddda96e32 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sat, 6 Feb 2010 02:27:10 +0000 Subject: Implement a warning diagnostic for weak vtables. Fixes PR6116. llvm-svn: 95472 --- clang/test/SemaCXX/warn-weak-vtables.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 clang/test/SemaCXX/warn-weak-vtables.cpp (limited to 'clang/test/SemaCXX/warn-weak-vtables.cpp') diff --git a/clang/test/SemaCXX/warn-weak-vtables.cpp b/clang/test/SemaCXX/warn-weak-vtables.cpp new file mode 100644 index 00000000000..1ea88a548e7 --- /dev/null +++ b/clang/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 struct B { + virtual void f() { } +}; + +namespace { + struct C { + virtual void f() { } + }; +} + +void f() { + struct A { + virtual void f() { } + }; +} \ No newline at end of file -- cgit v1.2.3