Add a configure test for std::make_unique

Seems like this is the only reliable way to determine whether we
have std::make_unique() or need to provide our own version.

Change-Id: I5b162e0a2d2448d7bc519958c6e85a075812135a
Fixes: QTBUG-71448
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Lars Knoll 2018-11-02 11:33:34 +01:00
parent 06f4b3761a
commit c765d5945b
2 changed files with 20 additions and 1 deletions

View File

@ -40,6 +40,7 @@
#pragma once
#include <QtCore/qglobal.h>
#include <QtQml/private/qtqmlglobal_p.h>
#include <memory>
#if __cplusplus > 201402L && QT_HAS_INCLUDE(<optional>)
@ -83,7 +84,7 @@ private:
#endif
#if __cplusplus < 201402L && !defined(__cpp_lib_make_unique) && !defined(Q_CC_MSVC) && !defined(Q_CC_GHS)
#if __cplusplus < 201402L && !QT_CONFIG(cxx14_make_unique)
namespace std {
template<typename T, class ...Args>

View File

@ -12,7 +12,25 @@
}
},
"tests": {
"cxx14_make_unique": {
"label": "C++14 make_unique()",
"type": "compile",
"test": {
"include": "memory",
"main": [
"std::unique_ptr<int> ptr = std::make_unique<int>();"
]
}
}
},
"features": {
"cxx14_make_unique": {
"label": "C++14 make_unique",
"condition": "tests.cxx14_make_unique",
"output": [ "privateFeature" ]
},
"qml-network": {
"label": "QML network support",
"purpose": "Provides network transparency.",