diff --git a/src/tools/clangbackend/source/tokeninfo.cpp b/src/tools/clangbackend/source/tokeninfo.cpp index 8f63de41874..8e380b639c7 100644 --- a/src/tools/clangbackend/source/tokeninfo.cpp +++ b/src/tools/clangbackend/source/tokeninfo.cpp @@ -599,6 +599,7 @@ void TokenInfo::punctuationOrOperatorKind() if (m_types.mainHighlightingType == HighlightingType::Punctuation && m_types.mixinHighlightingTypes.empty() + && kind != CXCursor_OverloadedDeclRef && kind != CXCursor_InclusionDirective && kind != CXCursor_PreprocessingDirective) { const ClangString spelling = m_token->spelling(); diff --git a/tests/unit/unittest/data/highlightingmarks.cpp b/tests/unit/unittest/data/highlightingmarks.cpp index 8221afc29f6..f4c9aa74bbb 100644 --- a/tests/unit/unittest/data/highlightingmarks.cpp +++ b/tests/unit/unittest/data/highlightingmarks.cpp @@ -771,3 +771,20 @@ void func(T v) { } static std::vector> pv; + +template +struct vecn +{ + T v[S]; +}; + +template +static inline constexpr vecn operator<(vecn a, vecn b) +{ + vecn x = vecn{}; + for(long i = 0; i < S; ++i) + { + x[i] = a[i] < b[i]; + } + return x; +} diff --git a/tests/unit/unittest/tokenprocessor-test.cpp b/tests/unit/unittest/tokenprocessor-test.cpp index 562f852abed..b7ebeba692e 100644 --- a/tests/unit/unittest/tokenprocessor-test.cpp +++ b/tests/unit/unittest/tokenprocessor-test.cpp @@ -1801,6 +1801,12 @@ TEST_F(TokenProcessor, NestedTemplate) HighlightingType::DoubleAngleBracketClose)); } +TEST_F(TokenProcessor, OperatorInTemplate) +{ + const auto infos = translationUnit.tokenInfosInRange(sourceRange(787, 28)); + ASSERT_THAT(infos[9], HasOnlyType(HighlightingType::Punctuation)); +} + Data *TokenProcessor::d; void TokenProcessor::SetUpTestCase()