summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Łoś <michal.los@siili.com>2024-05-08 14:08:42 +0200
committerMichał Łoś <michal.los@siili.com>2024-05-10 18:20:28 +0000
commitced943e936e335a16e9b479a2010e5bbee1af4f1 (patch)
treeedb7f1b6760d5cbd376a71f2add31d0a65b6ac50
parenta4341827ac17c14541ea69c67c76aaae5a09ddcc (diff)
Add compilation test instead of VxWorks check
`<future>` is explicitly excluded for VxWork, because enabling it causes compilation error when building tests (and causes some serious issues when trying to naively work-arond this compilation problem). When forcing `QT_FEATURE_cxx11_future` on VxWorks, failure occurs: ``` qtbase/src/corelib/thread/qthread.h:125:19: error: no matching function for call to 'invoke' 125 | (void)std::invoke(std::move(f), std::forward<decltype(largs)>(largs)...); | ^~~~~~~~~~~ [...] qtbase/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp:32:45: note: in instantiation of function template specialization 'QThread::create<(lambda at qtbase/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp:32:52), QPromise<int>>' requested here 32 | QScopedPointer<QThread> thread(QThread::create([] (QPromise<int> promise) { | ^ VSB/usr/h/public/type_traits:2720:7: note: candidate template ignored: substitution failure [with _Callable = remove_reference_t<(lambda at qtbase/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp:32:52) &>, _Types = <QPromise<int> &>]: no matching function for call to '_Call' 2720 | auto invoke(_Callable&& _Obj, _Types&&... _Args) noexcept(noexcept(_Invoker<_Callable, _Types...>::_Call( | ^ 2721 | _STD forward<_Callable>(_Obj), _STD forward<_Types>(_Args)...))) 2722 | -> decltype(_Invoker<_Callable, _Types...>::_Call( | ~~~~~~~~ ``` Instead of excluding cxx11_future on VxWorks explicitly, replace condition with actual check which should pass in non-VxWorks 24.03 (or older) standard libraries. VxWorks in version 24.03 fails this test due to std::async improperly forwards argument type to lambda, which causes compilation error when argument type is a non-copiable value type. This is a problem in VxWorks standard library, which could be fixed in future versions of this OS, so keeping this as a test should unlock `<future>` header once it's fixed. Pick-to: 6.7 Task-number: QTBUG-115777 Change-Id: Ic67df9be2e95dce999689eaea146f113017ab4f3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/corelib/configure.cmake30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/corelib/configure.cmake b/src/corelib/configure.cmake
index 80e6d93193..18c09d2241 100644
--- a/src/corelib/configure.cmake
+++ b/src/corelib/configure.cmake
@@ -430,6 +430,34 @@ const auto backtrace = std::stacktrace::current();
CXX_STANDARD 23
)
+# <future>
+qt_config_compile_test(cxx_std_async_noncopyable
+ LABEL "std::async() NonCopyable"
+ CODE
+"// Calling std::async with lambda which takes non-copyable argument causes compilation error on
+// some platforms (VxWorks 24.03 and older with C++17-compatibility for example)
+#include <future>
+
+class NonCopyable {
+public:
+ NonCopyable(const NonCopyable&) = delete;
+ NonCopyable(NonCopyable&&) = default;
+
+ NonCopyable(int value)
+ :value (value)
+ {}
+
+ int value;
+};
+
+int main(int argc, char** argv) {
+ return std::async(
+ std::launch::deferred,
+ [](NonCopyable value) { return value.value; },
+ NonCopyable(argc - 1)).get();
+}
+")
+
#### Features
qt_feature("clock-gettime" PRIVATE
@@ -458,7 +486,7 @@ qt_feature("system-doubleconversion" PRIVATE
)
qt_feature("cxx11_future" PUBLIC
LABEL "C++11 <future>"
- CONDITION NOT VXWORKS
+ CONDITION TEST_cxx_std_async_noncopyable
)
qt_feature("cxx17_filesystem" PUBLIC
LABEL "C++17 <filesystem>"