--- a/lexers/LexCPP.cxx
+++ b/lexers/LexCPP.cxx
@@ -1041,6 +1041,7 @@
 
 	unsigned int endPos = startPos + length;
 	int visibleChars = 0;
+	bool inLineComment = false;
 	int lineCurrent = styler.GetLine(startPos);
 	int levelCurrent = SC_FOLDLEVELBASE;
 	if (lineCurrent > 0)
@@ -1059,10 +1060,12 @@
 		style = styleNext;
 		styleNext = MaskActive(styler.StyleAt(i + 1));
 		bool atEOL = i == (lineStartNext-1);
-		if (options.foldComment && options.foldCommentMultiline && IsStreamCommentStyle(style)) {
-			if (!IsStreamCommentStyle(stylePrev) && (stylePrev != SCE_C_COMMENTLINEDOC)) {
+		if ((style == SCE_C_COMMENTLINE) || (style == SCE_C_COMMENTLINEDOC))
+			inLineComment = true;
+		if (options.foldComment && options.foldCommentMultiline && IsStreamCommentStyle(style) && !inLineComment) {
+			if (!IsStreamCommentStyle(stylePrev)) {
 				levelNext++;
-			} else if (!IsStreamCommentStyle(styleNext) && (styleNext != SCE_C_COMMENTLINEDOC) && !atEOL) {
+			} else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
 				// Comments don't end at end of line and the next character may be unstyled.
 				levelNext--;
 			}
@@ -1134,6 +1137,7 @@
 				styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG);
 			}
 			visibleChars = 0;
+			inLineComment = false;
 		}
 	}
 }