Skip to content

Commit 85522b0

Browse files
authored
Merge pull request #2319 from guwirth/fix-2318
Fix parsing error with right angle bracket detection
2 parents 84a3ea8 + 602f1ef commit 85522b0

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

cxx-squid/src/main/java/org/sonar/cxx/channels/RightAngleBracketsChannel.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ public boolean consume(CodeReader code, Lexer output) {
5353

5454
switch (ch) {
5555
case '(':
56-
parentheseLevel++;
56+
if (angleBracketLevel > 0) {
57+
parentheseLevel++;
58+
}
5759
break;
5860
case ')':
5961
if (parentheseLevel > 0) {

cxx-squid/src/test/java/org/sonar/cxx/parser/ExpressionTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ public void postfixExpression_reallife() {
337337
.matches("::foo()")
338338
.matches("obj.foo<int>()")
339339
.matches("typeid(int)")
340+
.matches("f(std::shared_ptr<A<int>>(p))") // fix #2286
340341
// C++/CLI
341342
.matches("G::typeid")
342343
.matches("int::typeid")

0 commit comments

Comments
 (0)