diff --git a/src/plugins/cppeditor/cppdoxygen_test.cpp b/src/plugins/cppeditor/cppdoxygen_test.cpp index c9c40a8dd80..7e2781a6ce4 100644 --- a/src/plugins/cppeditor/cppdoxygen_test.cpp +++ b/src/plugins/cppeditor/cppdoxygen_test.cpp @@ -326,6 +326,20 @@ void DoxygenTest::testBasic_data() "};\n" ); + QTest::newRow("classTemplate") << _( + "bool preventFolding;\n" + "/**|\n" + "template class C {\n" + "};\n" + ) << _( + "bool preventFolding;\n" + "/**\n" + " * @brief The C class\n" + " */\n" + "template class C {\n" + "};\n" + ); + QTest::newRow("continuation_after_text_in_first_line") << _( "bool preventFolding;\n" "/*! leading comment|\n" diff --git a/src/plugins/cppeditor/doxygengenerator.cpp b/src/plugins/cppeditor/doxygengenerator.cpp index aba3655b811..9ab9e109eb6 100644 --- a/src/plugins/cppeditor/doxygengenerator.cpp +++ b/src/plugins/cppeditor/doxygengenerator.cpp @@ -141,6 +141,9 @@ QString DoxygenGenerator::generate(QTextCursor cursor, QString DoxygenGenerator::generate(QTextCursor cursor, DeclarationAST *decl) { + if (const TemplateDeclarationAST * const templDecl = decl->asTemplateDeclaration()) + decl = templDecl->declaration; + SpecifierAST *spec = nullptr; DeclaratorAST *decltr = nullptr; if (SimpleDeclarationAST *simpleDecl = decl->asSimpleDeclaration()) {