llvm-for-llvmta/tools/clang/test/SemaCXX/warn-member-not-needed.cpp

20 lines
664 B
C++
Raw Permalink Normal View History

2022-04-25 13:02:35 +02:00
// RUN: %clang_cc1 -fsyntax-only -verify -Wunneeded-member-function -Wno-unused-template %s
namespace {
class A {
void g() {} // expected-warning {{member function 'g' is not needed and will not be emitted}}
template <typename T> void gt(T) {}
template <> void gt<int>(int) {} // expected-warning {{member function 'gt<int>' is not needed and will not be emitted}}
template <> void gt(float) {} // expected-warning {{member function 'gt<float>' is not needed and will not be emitted}}
template <typename T>
void foo() {
g();
gt(0);
gt(0.0f);
gt(0.0);
}
};
template void A::gt(double); // no-warning
}