diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java index 3ebfbcb083b..a3690dacfa1 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java @@ -1352,15 +1352,15 @@ public class CodeFormatterVisitor extends CPPASTVisitor { } private int visit(IASTNamedTypeSpecifier node) { + if (scribe.printModifiers()) { + scribe.space(); + } if (node instanceof ICPPASTNamedTypeSpecifier) { if (((ICPPASTNamedTypeSpecifier)node).isTypename()) { scribe.printNextToken(Token.t_typename); scribe.space(); } } - if (scribe.printModifiers()) { - scribe.space(); - } node.getName().accept(this); return PROCESS_SKIP; } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java index 2578189b9fe..ef7f6570662 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java @@ -1157,4 +1157,14 @@ public class CodeFormatterTest extends BaseUITestCase { assertFormatterResult(); } + //inline typename A foo(); + //void bar(const typename A x) ; + //static typename A x ; + + //inline typename A foo(); + //void bar(const typename A x); + //static typename A x; + public void testFormatterProblemsWithTypename_Bug269590() throws Exception { + assertFormatterResult(); + } }