diff --git a/src/libs/cplusplus/TypePrettyPrinter.cpp b/src/libs/cplusplus/TypePrettyPrinter.cpp
index 3f4e1274c3dbc7b929acd8311cc3826b80fe6794..4d08bd7109fd2025ea1342efbfbbf793ad9af7a6 100644
--- a/src/libs/cplusplus/TypePrettyPrinter.cpp
+++ b/src/libs/cplusplus/TypePrettyPrinter.cpp
@@ -141,12 +141,12 @@ QList<FullySpecifiedType> TypePrettyPrinter::switchPtrOperators(const QList<Full
 
 void TypePrettyPrinter::applyPtrOperators(bool wantSpace)
 {
+    if (wantSpace && !_ptrOperators.isEmpty())
+        space();
+
     for (int i = _ptrOperators.size() - 1; i != -1; --i) {
         const FullySpecifiedType op = _ptrOperators.at(i);
 
-        if (i == 0 && wantSpace)
-            space();
-
         if (op->isPointerType()) {
             _text += QLatin1Char('*');
             outCV(op);
@@ -161,6 +161,11 @@ void TypePrettyPrinter::applyPtrOperators(bool wantSpace)
     }
 }
 
+void TypePrettyPrinter::visit(UndefinedType *)
+{
+    applyPtrOperators();
+}
+
 void TypePrettyPrinter::visit(VoidType *)
 {
     _text += QLatin1String("void");
diff --git a/src/libs/cplusplus/TypePrettyPrinter.h b/src/libs/cplusplus/TypePrettyPrinter.h
index ab7e42974f82eaa311d941f0f057d8fd1d11b83e..75741aa77cc08e96a3b070349bff93c908205b8b 100644
--- a/src/libs/cplusplus/TypePrettyPrinter.h
+++ b/src/libs/cplusplus/TypePrettyPrinter.h
@@ -58,6 +58,7 @@ protected:
     void applyPtrOperators(bool wantSpace = true);
     void acceptType(const FullySpecifiedType &ty);
 
+    virtual void visit(UndefinedType *type);
     virtual void visit(VoidType *type);
     virtual void visit(IntegerType *type);
     virtual void visit(FloatType *type);