mirror of
https://github.com/simonbrunel/qtpromise.git
synced 2025-07-07 09:45:24 +08:00
Broken since 78417b5
, this bug creates an infinite recursion at runtime while trying to resolve the QPromise<T> template constructor if the given callback is either an invalid function or a valid callback but using auto args (C++14).
Related warning: C4717: recursive on all control paths, function will cause runtime stack overflow.
34 lines
855 B
C++
34 lines
855 B
C++
/*
|
|
* Copyright (c) Simon Brunel, https://github.com/simonbrunel
|
|
*
|
|
* This source code is licensed under the MIT license found in
|
|
* the LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#include <QtPromise>
|
|
#include <QtTest>
|
|
|
|
using namespace QtPromisePrivate;
|
|
|
|
class tst_cpp14_argsof_lambda_auto : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
private Q_SLOTS:
|
|
void lambdaAutoArgs();
|
|
};
|
|
|
|
QTEST_MAIN(tst_cpp14_argsof_lambda_auto)
|
|
#include "tst_argsof_lambda_auto.moc"
|
|
|
|
void tst_cpp14_argsof_lambda_auto::lambdaAutoArgs()
|
|
{
|
|
auto lOneArg = [](auto) {};
|
|
auto lManyArgs = [](const auto&, auto, auto) {};
|
|
auto lMutable = [](const auto&, auto) mutable {};
|
|
|
|
Q_STATIC_ASSERT((ArgsOf<decltype(lOneArg)>::count == 0));
|
|
Q_STATIC_ASSERT((ArgsOf<decltype(lManyArgs)>::count == 0));
|
|
Q_STATIC_ASSERT((ArgsOf<decltype(lMutable)>::count == 0));
|
|
}
|