Get rid of never used conversion function warning
Closed, ResolvedPublic

Description

Currently we get the following warning due to the implicit conversion operator to Job<void>:

In file included from /home/chrigi/kdebuild/kube/source/kasync/autotests/asynctest.cpp:25:
/home/chrigi/kdebuild/kube/source/kasync/src/async.h:646:5: warning: conversion function converting 'KAsync::Job<void>' to itself will never be used
    operator Job<void>();
    ^
/home/chrigi/kdebuild/kube/source/kasync/src/job_impl.h:322:19: note: in instantiation of template class 'KAsync::Job<void>' requested here
Job<Out, In ...>::operator Job<void>()
                  ^
1 warning generated.

I tried fixing it like so:

template<
    typename U = Out,
    typename = typename std::enable_if<!std::is_void<U>::value >::type
>
operator Job<void>()
{
    return thenImpl<void>({[](){ return KAsync::null<void>(); }}, {});
}

But without success.
There also doesn't seem to be a compiler flag that could be tweaked to turn of the warning (or an attribute that could be used for that...).

cmollekopf updated the task description. (Show Details)
dvratil moved this task from Backlog to Done on the KASync board.
dvratil added a subscriber: dvratil.

Fixed in master (see the commit message for details).

cmollekopf closed this task as Resolved.Mar 8 2017, 11:09 AM
cmollekopf claimed this task.

Nice!