20 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify -Wunneeded-member-function -Wno-unused-template %s2 3namespace {4 class A {5 void g() {} // expected-warning {{member function 'g' is not needed and will not be emitted}}6 template <typename T> void gt(T) {}7 template <> void gt<int>(int) {} // expected-warning {{member function 'gt<int>' is not needed and will not be emitted}}8 template <> void gt(float) {} // expected-warning {{member function 'gt<float>' is not needed and will not be emitted}}9 10 template <typename T>11 void foo() {12 g();13 gt(0);14 gt(0.0f);15 gt(0.0);16 }17 };18 template void A::gt(double); // no-warning19}20