diff --git a/src/libs/3rdparty/cplusplus/Lexer.cpp b/src/libs/3rdparty/cplusplus/Lexer.cpp
index a508ce3d302b5d97ada426302b07e0f675d3c48e..feddf3a5d07b4f2d570ccb012743f7841794d92c 100644
--- a/src/libs/3rdparty/cplusplus/Lexer.cpp
+++ b/src/libs/3rdparty/cplusplus/Lexer.cpp
@@ -610,8 +610,12 @@ void Lexer::scan_helper(Token *tok)
             yyinp();
             tok->f.kind = T_LESS_EQUAL;
         } else if (_yychar == ':') {
-            yyinp();
-            tok->f.kind = T_LBRACKET;
+            if (*(_currentChar+1) != ':' || *(_currentChar+2) == ':' || *(_currentChar+2) == '>') {
+                yyinp();
+                tok->f.kind = T_LBRACKET;
+            } else {
+                tok->f.kind = T_LESS;
+            }
         } else if (_yychar == '%') {
             yyinp();
             tok->f.kind = T_LBRACE;
diff --git a/tests/auto/cplusplus/lexer/tst_lexer.cpp b/tests/auto/cplusplus/lexer/tst_lexer.cpp
index 53da805a684d7e07699581fbf170dd18646adc04..92115bc05c61d8fdf50b2491b55d2ea420a79243 100644
--- a/tests/auto/cplusplus/lexer/tst_lexer.cpp
+++ b/tests/auto/cplusplus/lexer/tst_lexer.cpp
@@ -770,6 +770,14 @@ void tst_SimpleLexer::digraph_data()
     QTest::newRow("pound_pound_mixed_digraph_1") << _("#%:") << (TokenKindList() << T_POUND << T_POUND);
 
     QTest::newRow("pound_pound_mixed_digraph_2") << _("%:#") << (TokenKindList() << T_POUND << T_POUND);
+
+    QTest::newRow("lbracket_digraph_exception1") << _("<::") << (TokenKindList() << T_LESS << T_COLON_COLON);
+
+    QTest::newRow("lbracket_digraph_exception2") << _("<::x") << (TokenKindList() << T_LESS << T_COLON_COLON << T_IDENTIFIER);
+
+    QTest::newRow("lbracket_digraph_exception3") << _("<:::") << (TokenKindList() << T_LBRACKET << T_COLON_COLON);
+
+    QTest::newRow("lbracket_digraph_exception4") << _("<::>") << (TokenKindList() << T_LBRACKET << T_RBRACKET);
 }
 
 void tst_SimpleLexer::trigraph()