xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/warn-func-not-needed.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify -Wall %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc namespace test1 {
f()4*f4a2713aSLionel Sambuc   static void f() {} // expected-warning {{is not needed and will not be emitted}}
5*f4a2713aSLionel Sambuc   static void f();
6*f4a2713aSLionel Sambuc   template <typename T>
foo()7*f4a2713aSLionel Sambuc   void foo() {
8*f4a2713aSLionel Sambuc     f();
9*f4a2713aSLionel Sambuc   }
10*f4a2713aSLionel Sambuc }
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc namespace test2 {
f()13*f4a2713aSLionel Sambuc   static void f() {}
14*f4a2713aSLionel Sambuc   static void f();
g()15*f4a2713aSLionel Sambuc   static void g() { f(); }
h()16*f4a2713aSLionel Sambuc   void h() { g(); }
17*f4a2713aSLionel Sambuc }
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc namespace test3 {
20*f4a2713aSLionel Sambuc   static void f();
21*f4a2713aSLionel Sambuc   template<typename T>
g()22*f4a2713aSLionel Sambuc   static void g() {
23*f4a2713aSLionel Sambuc     f();
24*f4a2713aSLionel Sambuc   }
f()25*f4a2713aSLionel Sambuc   static void f() {
26*f4a2713aSLionel Sambuc   }
h()27*f4a2713aSLionel Sambuc   void h() {
28*f4a2713aSLionel Sambuc     g<int>();
29*f4a2713aSLionel Sambuc   }
30*f4a2713aSLionel Sambuc }
31*f4a2713aSLionel Sambuc 
32*f4a2713aSLionel Sambuc namespace test4 {
33*f4a2713aSLionel Sambuc   static void f();
34*f4a2713aSLionel Sambuc   static void f();
35*f4a2713aSLionel Sambuc   template<typename T>
g()36*f4a2713aSLionel Sambuc   static void g() {
37*f4a2713aSLionel Sambuc     f();
38*f4a2713aSLionel Sambuc   }
f()39*f4a2713aSLionel Sambuc   static void f() {
40*f4a2713aSLionel Sambuc   }
h()41*f4a2713aSLionel Sambuc   void h() {
42*f4a2713aSLionel Sambuc     g<int>();
43*f4a2713aSLionel Sambuc   }
44*f4a2713aSLionel Sambuc }
45*f4a2713aSLionel Sambuc 
46*f4a2713aSLionel Sambuc namespace test4 {
47*f4a2713aSLionel Sambuc   static void func();
bar()48*f4a2713aSLionel Sambuc   void bar() {
49*f4a2713aSLionel Sambuc     void func();
50*f4a2713aSLionel Sambuc     func();
51*f4a2713aSLionel Sambuc   }
func()52*f4a2713aSLionel Sambuc   static void func() {}
53*f4a2713aSLionel Sambuc }
54