Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaCXX / warn-func-not-needed.cpp
blobcb3cae4cd6c7611aa3a884b1581a860a400cd4a7
1 // RUN: %clang_cc1 -fsyntax-only -verify -Wall %s
3 namespace test1 {
4 static void f() {} // expected-warning {{function 'f' is not needed and will not be emitted}}
5 static void f();
6 template <typename T>
7 void foo() {
8 f();
12 namespace test1_template {
13 template <typename T> static void f() {}
14 template <> void f<int>() {} // expected-warning {{function 'f<int>' is not needed and will not be emitted}}
15 template <typename T>
16 void foo() {
17 f<int>();
18 f<long>();
20 } // namespace test1_template
22 namespace test2 {
23 static void f() {}
24 static void f();
25 static void g() { f(); }
26 void h() { g(); }
29 namespace test3 {
30 static void f();
31 template<typename T>
32 static void g() {
33 f();
35 static void f() {
37 void h() {
38 g<int>();
42 namespace test4 {
43 static void f();
44 static void f();
45 template<typename T>
46 static void g() {
47 f();
49 static void f() {
51 void h() {
52 g<int>();
56 namespace test4 {
57 static void func();
58 void bar() {
59 void func();
60 func();
62 static void func() {}