From c2c8b137c04de8dfd92d376a0fd2493a6336c0e6 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 5 Apr 2022 13:37:09 +0200 Subject: [PATCH] CppEditor: Ensure a space between ref qualifier and exception spec Task-number: QTCREATORBUG-27132 Change-Id: Iedb983f58ece345d5997607d2e557e36c951750f Reviewed-by: Christian Stenger Reviewed-by: --- src/libs/cplusplus/TypePrettyPrinter.cpp | 5 ++++- src/plugins/cppeditor/cppquickfix_test.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libs/cplusplus/TypePrettyPrinter.cpp b/src/libs/cplusplus/TypePrettyPrinter.cpp index b184e2a1e1a..d6a2ce84fac 100644 --- a/src/libs/cplusplus/TypePrettyPrinter.cpp +++ b/src/libs/cplusplus/TypePrettyPrinter.cpp @@ -531,7 +531,10 @@ void TypePrettyPrinter::visit(Function *type) // add exception specifier if (const StringLiteral *spec = type->exceptionSpecification()) { - appendSpace(); + if (type->refQualifier() != Function::NoRefQualifier) + _text.append(' '); + else + appendSpace(); _text += QLatin1String(spec->chars()); } } diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp index c0ee38d6e27..a2ed383c12f 100644 --- a/src/plugins/cppeditor/cppquickfix_test.cpp +++ b/src/plugins/cppeditor/cppquickfix_test.cpp @@ -6137,7 +6137,7 @@ struct Derived : public Base { original = "#include \"file.h\"\n"; expected = R"DELIM(#include "file.h" -auto Derived::func() const &&noexcept -> void {} +auto Derived::func() const && noexcept -> void {} )DELIM"; testDocuments << CppTestDocument::create("file.cpp", original, expected);