From 610ff191afe7b550586a72a8a9f12cf0c6c84273 Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Tue, 1 Sep 2015 10:10:20 +0200 Subject: [PATCH] TextEditor: Move constructor has now noexcept Otherwise the copy constructor will be used too and we get an error because it is private. Change-Id: Ibfe70939ebe34fa9a524b9844a20d962eb09bd97 Reviewed-by: Christian Stenger Reviewed-by: David Schulz --- src/plugins/clangcodemodel/clangtextmark.cpp | 5 +++++ src/plugins/clangcodemodel/clangtextmark.h | 5 +++++ src/plugins/texteditor/textmark.cpp | 2 +- src/plugins/texteditor/textmark.h | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/plugins/clangcodemodel/clangtextmark.cpp b/src/plugins/clangcodemodel/clangtextmark.cpp index e6692487637..156f4c575db 100644 --- a/src/plugins/clangcodemodel/clangtextmark.cpp +++ b/src/plugins/clangcodemodel/clangtextmark.cpp @@ -78,5 +78,10 @@ ClangTextMark::ClangTextMark(const QString &fileName, int lineNumber, ClangBackE setIcon(iconForSeverity(severity)); } +ClangTextMark::ClangTextMark(ClangTextMark &&other) Q_DECL_NOEXCEPT + : TextMark(std::move(other)) +{ +} + } // namespace ClangCodeModel diff --git a/src/plugins/clangcodemodel/clangtextmark.h b/src/plugins/clangcodemodel/clangtextmark.h index fe55a9d56d3..5d7752ad437 100644 --- a/src/plugins/clangcodemodel/clangtextmark.h +++ b/src/plugins/clangcodemodel/clangtextmark.h @@ -41,6 +41,11 @@ class ClangTextMark : public TextEditor::TextMark { public: ClangTextMark(const QString &fileName, int lineNumber, ClangBackEnd::DiagnosticSeverity severity); + + ClangTextMark(ClangTextMark &&other) Q_DECL_NOEXCEPT; + + ClangTextMark(ClangTextMark &other) = delete; + ClangTextMark &operator=(ClangTextMark &other) = delete; }; } // namespace ClangCodeModel diff --git a/src/plugins/texteditor/textmark.cpp b/src/plugins/texteditor/textmark.cpp index e3a692e7355..f4984857726 100644 --- a/src/plugins/texteditor/textmark.cpp +++ b/src/plugins/texteditor/textmark.cpp @@ -65,7 +65,7 @@ TextMark::~TextMark() m_baseTextDocument = 0; } -TextMark::TextMark(TextMark &&other) +TextMark::TextMark(TextMark &&other) Q_DECL_NOEXCEPT : m_baseTextDocument(std::move(other.m_baseTextDocument)), m_fileName(std::move(other.m_fileName)), m_lineNumber(std::move(other.m_lineNumber)), diff --git a/src/plugins/texteditor/textmark.h b/src/plugins/texteditor/textmark.h index 468196138dd..f316ea06cd9 100644 --- a/src/plugins/texteditor/textmark.h +++ b/src/plugins/texteditor/textmark.h @@ -57,7 +57,7 @@ public: TextMark(const QString &fileName, int lineNumber, Core::Id category); virtual ~TextMark(); - TextMark(TextMark &&other); + TextMark(TextMark &&other) Q_DECL_NOEXCEPT; // determine order on markers on the same line. enum Priority