Skip to content

Commit

Permalink
Unittest: Resolve unused argument warning
Browse files Browse the repository at this point in the history
In case the typelist is empty, GCC 5 would warn about name being unused.
By constructing a local string copy this should be resolved.

Signed-off-by: Matthias Kretz <kretz@kde.org>
  • Loading branch information
mattkretz committed Sep 15, 2016
1 parent 512fab4 commit 2b1ad38
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/unittest.h
Original file line number Diff line number Diff line change
Expand Up @@ -1409,14 +1409,16 @@ template <std::size_t I, typename Indexer>
using TypeAtIndex = typename decltype(TypelistIndexing::select<I>(Indexer{}))::type;

template <template <typename> class TestWrapper, typename... Ts, std::size_t... I>
static int addTestInstantiations(const char *name, Typelist<Ts...>,
static int addTestInstantiations(const char *basename, Typelist<Ts...>,
Vc::index_sequence<I...>)
{
using Indexer = TypelistIndexing::indexer<Vc::index_sequence<I...>, Ts...>;
std::string name(basename);
name += '<';
const auto &x = {
0, (g_allTests.emplace_back(
&TestWrapper<TypeAtIndex<I, Indexer>>::run,
std::string(name) + '<' + typeToString<TypeAtIndex<I, Indexer>>() + '>'),
name + typeToString<TypeAtIndex<I, Indexer>>() + '>'),
0)...};
auto &&unused = [](decltype(x)) {};
unused(x);
Expand Down

0 comments on commit 2b1ad38

Please sign in to comment.