Debian Codegraph @

clang/test/SemaCXX/warn-func-not-needed.cpp

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify -Wall %s
2
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();
9 }
10 }
11
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>();
19 }
20 } // namespace test1_template
21
22 namespace test2 {
23 static void f() {}
24 static void f();
25 static void g() { f(); }
26 void h() { g(); }
27 }
28
29 namespace test3 {
30 static void f();
31 template<typename T>
32 static void g() {
33 f();
34 }
35 static void f() {
36 }
37 void h() {
38 g<int>();
39 }
40 }
41
42 namespace test4 {
43 static void f();
44 static void f();
45 template<typename T>
46 static void g() {
47 f();
48 }
49 static void f() {
50 }
51 void h() {
52 g<int>();
53 }
54 }
55
56 namespace test4 {
57 static void func();
58 void bar() {
59 void func();
60 func();
61 }
62 static void func() {}
63 }