From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/SemaCXX/warn-unused-parameters.cpp | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 clang/test/SemaCXX/warn-unused-parameters.cpp (limited to 'clang/test/SemaCXX/warn-unused-parameters.cpp') diff --git a/clang/test/SemaCXX/warn-unused-parameters.cpp b/clang/test/SemaCXX/warn-unused-parameters.cpp new file mode 100644 index 0000000..00ce1a9 --- /dev/null +++ b/clang/test/SemaCXX/warn-unused-parameters.cpp @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -fsyntax-only -Wunused-parameter -verify -std=c++11 %s +template +struct X { + T f0(T x); + T f1(T x); + T f2(T); + template U f3(U x); + template U f4(U x); + template U f5(U); +}; + +template T X::f0(T x) { return x; } +template T X::f1(T) { return T(); } +template T X::f2(T x) { return T(); } // expected-warning{{unused parameter 'x'}} +template template U X::f3(U x) { return x; } +template template U X::f4(U) { return U(); } +template template U X::f5(U x) { return U(); } // expected-warning{{unused parameter 'x'}} + +void test_X(X &x, int i) { + x.f0(i); + x.f1(i); + x.f2(i); + x.f3(i); + x.f4(i); + x.f5(i); +} + +// Make sure both parameters aren't considered unused. +template +static int test_pack(T... t, T... s) +{ + auto l = [&t...]() { return sizeof...(s); }; + return l(); +} -- cgit v1.2.3