Home | History | Annotate | Download | only in SemaCXX
      1 // RUN: %clang_cc1 -fsyntax-only -Wunused-parameter -verify -std=c++11 %s
      2 template<typename T>
      3 struct X {
      4   T f0(T x);
      5   T f1(T x);
      6   T f2(T);
      7   template<typename U> U f3(U x);
      8   template<typename U> U f4(U x);
      9   template<typename U> U f5(U);
     10 };
     11 
     12 template<typename T> T X<T>::f0(T x) { return x; }
     13 template<typename T> T X<T>::f1(T) { return T(); }
     14 template<typename T> T X<T>::f2(T x) { return T(); } // expected-warning{{unused parameter 'x'}}
     15 template<typename T> template<typename U> U X<T>::f3(U x) { return x; }
     16 template<typename T> template<typename U> U X<T>::f4(U) { return U(); }
     17 template<typename T> template<typename U> U X<T>::f5(U x) { return U(); } // expected-warning{{unused parameter 'x'}}
     18 
     19 void test_X(X<int> &x, int i) {
     20   x.f0(i);
     21   x.f1(i);
     22   x.f2(i);
     23   x.f3(i);
     24   x.f4(i);
     25   x.f5(i);
     26 }
     27 
     28 // Make sure both parameters aren't considered unused.
     29 template <typename... T>
     30 static int test_pack(T... t, T... s)
     31 {
     32   auto l = [&t...]() { return sizeof...(s); };
     33   return l();
     34 }
     35