blob: c0cfd74a3e528665675703c33203043433f51977 [file] [log] [blame]
Anders Carlsson1610b812010-02-06 02:27:10 +00001// RUN: %clang_cc1 %s -fsyntax-only -verify -Wweak-vtables
2
3struct A { // expected-warning {{'A' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit}}
4 virtual void f() { }
5};
6
7template<typename T> struct B {
8 virtual void f() { }
9};
10
11namespace {
12 struct C {
13 virtual void f() { }
14 };
15}
16
17void f() {
18 struct A {
19 virtual void f() { }
20 };
Douglas Gregor6fb745b2010-05-13 16:44:06 +000021
22 A *a;
23 a->f();
24}
25
26// Use the vtables
27void uses(A &a, B<int> &b, C &c) {
28 a.f();
29 b.f();
30 c.f();
Chris Lattner83e7a782010-04-07 22:58:06 +000031}