diff --git a/src/libs/3rdparty/cplusplus/Bind.cpp b/src/libs/3rdparty/cplusplus/Bind.cpp index d3996ba79c3..ccd04dcb6ff 100644 --- a/src/libs/3rdparty/cplusplus/Bind.cpp +++ b/src/libs/3rdparty/cplusplus/Bind.cpp @@ -1918,7 +1918,7 @@ bool Bind::visit(SimpleDeclarationAST *ast) for (DeclaratorListAST *it = ast->declarator_list; it; it = it->next) { DeclaratorIdAST *declaratorId = 0; - FullySpecifiedType declTy = this->declarator(it->value, type.qualifiedType(), &declaratorId); + FullySpecifiedType declTy = this->declarator(it->value, type, &declaratorId); const Name *declName = 0; unsigned sourceLocation = location(it->value, ast->firstToken()); diff --git a/src/libs/3rdparty/cplusplus/FullySpecifiedType.cpp b/src/libs/3rdparty/cplusplus/FullySpecifiedType.cpp index 9685148baf9..3005e717c18 100644 --- a/src/libs/3rdparty/cplusplus/FullySpecifiedType.cpp +++ b/src/libs/3rdparty/cplusplus/FullySpecifiedType.cpp @@ -235,8 +235,5 @@ void FullySpecifiedType::copySpecifiers(const FullySpecifiedType &type) bool FullySpecifiedType::match(const FullySpecifiedType &otherTy, Matcher *matcher) const { - if (_flags != otherTy._flags) - return false; - return type()->match(otherTy.type(), matcher); } diff --git a/src/plugins/cppeditor/cppeditorplugin.h b/src/plugins/cppeditor/cppeditorplugin.h index 927d4ff9a0c..8f06b219b45 100644 --- a/src/plugins/cppeditor/cppeditorplugin.h +++ b/src/plugins/cppeditor/cppeditorplugin.h @@ -210,6 +210,7 @@ private slots: void test_quickfix_MoveFuncDefToDecl_CtorWithInitialization(); void test_quickfix_MoveFuncDefToDecl_structWithAssignedVariable(); void test_quickfix_MoveFuncDefToDecl_macroUses(); + void test_quickfix_MoveFuncDefToDecl_override(); void test_quickfix_AssignToLocalVariable_templates(); diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp index caa1d98a597..90fd64f00b2 100644 --- a/src/plugins/cppeditor/cppquickfix_test.cpp +++ b/src/plugins/cppeditor/cppquickfix_test.cpp @@ -4145,6 +4145,36 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefToDecl_macroUses() ProjectPart::HeaderPaths(), 0, "QTCREATORBUG-12314"); } +void CppEditorPlugin::test_quickfix_MoveFuncDefToDecl_override() +{ + QByteArray original = + "struct Base {\n" + " virtual int foo() = 0;\n" + "};\n" + "struct Derived : Base {\n" + " int foo() override;\n" + "};\n" + "\n" + "int Derived::fo@o()\n" + "{\n" + " return 5;\n" + "}\n"; + + QByteArray expected = + "struct Base {\n" + " virtual int foo() = 0;\n" + "};\n" + "struct Derived : Base {\n" + " int foo() override\n" + " {\n" + " return 5;\n" + " }\n" + "};\n\n\n"; + + MoveFuncDefToDecl factory; + QuickFixOperationTest(singleDocument(original, expected), &factory); +} + void CppEditorPlugin::test_quickfix_AssignToLocalVariable_templates() {