64 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify -Wall %s2 3namespace test1 {4static void f() {} // expected-warning {{function 'f' is not needed and will not be emitted}}5static void f();6template <typename T>7void foo() {8 f();9}10}11 12namespace test1_template {13template <typename T> static void f() {}14template <> void f<int>() {} // expected-warning {{function 'f<int>' is not needed and will not be emitted}}15template <typename T>16void foo() {17 f<int>();18 f<long>();19}20} // namespace test1_template21 22namespace test2 {23 static void f() {}24 static void f();25 static void g() { f(); }26 void h() { g(); }27}28 29namespace 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 42namespace 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 56namespace test4 {57 static void func();58 void bar() {59 void func();60 func();61 }62 static void func() {}63}64