diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp
index 276e5b24eb145f6782ea184fafb8463edb042f5c..2a681e858c514331a8ba32488909df83f2acea07 100644
--- a/src/plugins/cppeditor/cppeditor.cpp
+++ b/src/plugins/cppeditor/cppeditor.cpp
@@ -1435,8 +1435,12 @@ bool CPPEditor::contextAllowsAutoParentheses(const QTextCursor &cursor) const
     CPlusPlus::TokenUnderCursor tokenUnderCursor;
     const SimpleToken tk = tokenUnderCursor(cursor);
 
-    if (tk.isComment())
-        return false;
+    if (tk.isComment()) {
+        const int pos = cursor.selectionEnd();
+
+        if (pos < tk.end())
+            return false;
+    }
 
     return true;
 }