[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / SemaCXX / warn-weak-vtables.cpp
blob083209fa5e3153f2d169dcc6c8206ab14d7aaf1f
1 // RUN: %clang_cc1 %s -fsyntax-only -verify -triple %itanium_abi_triple -Wweak-vtables
2 //
3 // Check that this warning is disabled on MS ABI targets which don't have key
4 // functions.
5 // RUN: %clang_cc1 %s -fsyntax-only -triple %ms_abi_triple -Werror -Wweak-vtables
6 //
7 // -Wweak-template-vtables is deprecated but we still parse it.
8 // RUN: %clang_cc1 %s -fsyntax-only -Werror -Wweak-template-vtables
10 struct A { // expected-warning {{'A' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit}}
11 virtual void f() { }
14 template<typename T> struct B {
15 virtual void f() { }
18 namespace {
19 struct C {
20 virtual void f() { }
24 void f() {
25 struct A {
26 virtual void f() { }
29 A a;
32 // Use the vtables
33 void uses_abc() {
34 A a;
35 B<int> b;
36 C c;
39 // <rdar://problem/9979458>
40 class Parent {
41 public:
42 Parent() {}
43 virtual ~Parent();
44 virtual void * getFoo() const = 0;
47 class Derived : public Parent {
48 public:
49 Derived();
50 void * getFoo() const;
53 class VeryDerived : public Derived { // expected-warning{{'VeryDerived' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit}}
54 public:
55 void * getFoo() const { return 0; }
58 Parent::~Parent() {}
60 void uses_derived() {
61 Derived d;
62 VeryDerived vd;
65 template<typename T> struct TemplVirt {
66 virtual void f();
69 template class TemplVirt<float>;
71 template<> struct TemplVirt<bool> {
72 virtual void f();
75 template<> struct TemplVirt<long> { // expected-warning{{'TemplVirt<long>' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit}}
76 virtual void f() {}
79 void uses_templ() {
80 TemplVirt<float> f;
81 TemplVirt<bool> b;
82 TemplVirt<long> l;