forked from qt-creator/qt-creator
Fix compilation issues with C++17
Testable on Linux/macOS by changing c++14 to c++1z in qtcreator.pri. Testable with latest MSVC2017 by setting _CL_=/std:c++17. unary_function, binary_function, and a few other things that were deprecated are removed in C++17. std::string got a non-const overload for its "data" member function, so we cannot create a function pointer on it without specifying its type. Use std::declval instead (though it requires a default constructor for the type). MSVC seems to have an issue with Utils::transform for std::vector (used in Nim plugin), but that looks like a compiler issue. Change-Id: I94f9a93d591d55b610f86fabfc618158927d6221 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -168,7 +168,7 @@ static QList<QByteArray> fullIdForSymbol(CPlusPlus::Symbol *symbol)
|
||||
|
||||
namespace {
|
||||
|
||||
class ProcessFile: public std::unary_function<QString, QList<CPlusPlus::Usage> >
|
||||
class ProcessFile
|
||||
{
|
||||
const WorkingCopy workingCopy;
|
||||
const CPlusPlus::Snapshot snapshot;
|
||||
@@ -177,6 +177,10 @@ class ProcessFile: public std::unary_function<QString, QList<CPlusPlus::Usage> >
|
||||
QFutureInterface<CPlusPlus::Usage> *future;
|
||||
|
||||
public:
|
||||
// needed by QtConcurrent
|
||||
using argument_type = const Utils::FileName &;
|
||||
using result_type = QList<CPlusPlus::Usage>;
|
||||
|
||||
ProcessFile(const WorkingCopy &workingCopy,
|
||||
const CPlusPlus::Snapshot snapshot,
|
||||
CPlusPlus::Document::Ptr symbolDocument,
|
||||
@@ -230,7 +234,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class UpdateUI: public std::binary_function<QList<CPlusPlus::Usage> &, QList<CPlusPlus::Usage>, void>
|
||||
class UpdateUI
|
||||
{
|
||||
QFutureInterface<CPlusPlus::Usage> *future;
|
||||
|
||||
@@ -596,7 +600,7 @@ static void searchFinished(SearchResult *search, QFutureWatcher<CPlusPlus::Usage
|
||||
|
||||
namespace {
|
||||
|
||||
class FindMacroUsesInFile: public std::unary_function<QString, QList<CPlusPlus::Usage> >
|
||||
class FindMacroUsesInFile
|
||||
{
|
||||
const WorkingCopy workingCopy;
|
||||
const CPlusPlus::Snapshot snapshot;
|
||||
@@ -604,6 +608,10 @@ class FindMacroUsesInFile: public std::unary_function<QString, QList<CPlusPlus::
|
||||
QFutureInterface<CPlusPlus::Usage> *future;
|
||||
|
||||
public:
|
||||
// needed by QtConcurrent
|
||||
using argument_type = const Utils::FileName &;
|
||||
using result_type = QList<CPlusPlus::Usage>;
|
||||
|
||||
FindMacroUsesInFile(const WorkingCopy &workingCopy,
|
||||
const CPlusPlus::Snapshot snapshot,
|
||||
const CPlusPlus::Macro ¯o,
|
||||
|
||||
Reference in New Issue
Block a user