diff --git a/cpp/common/src/codingstandards/cpp/rules/identifierhidden/IdentifierHidden.qll b/cpp/common/src/codingstandards/cpp/rules/identifierhidden/IdentifierHidden.qll index 91d9720c8..d5d8a0d93 100644 --- a/cpp/common/src/codingstandards/cpp/rules/identifierhidden/IdentifierHidden.qll +++ b/cpp/common/src/codingstandards/cpp/rules/identifierhidden/IdentifierHidden.qll @@ -7,7 +7,6 @@ import codingstandards.cpp.Customizations import codingstandards.cpp.Exclusions import codingstandards.cpp.Scope import codingstandards.cpp.ConstHelpers -import codingstandards.cpp.Expr abstract class IdentifierHiddenSharedQuery extends Query { } @@ -59,11 +58,11 @@ predicate hiddenInLambda(UserVariable outerDecl, UserVariable innerDecl) { or //it is a reference that has been initialized with a constant expression. outerDecl.getType().stripTopLevelSpecifiers() instanceof ReferenceType and - isCompileTimeEvaluatedExpression(outerDecl.getInitializer().getExpr()) + outerDecl.getInitializer().getExpr() instanceof Literal or - //it const non-volatile integral or enumeration type and has been initialized with a constant expression + // //it const non-volatile integral or enumeration type and has been initialized with a constant expression outerDecl instanceof NonVolatileConstIntegralOrEnumVariable and - isCompileTimeEvaluatedExpression(outerDecl.getInitializer().getExpr()) + outerDecl.getInitializer().getExpr() instanceof Literal or //it is constexpr and has no mutable members outerDecl.isConstexpr() and diff --git a/cpp/common/test/rules/identifierhidden/IdentifierHidden.expected b/cpp/common/test/rules/identifierhidden/IdentifierHidden.expected index 3ed0ce6f9..1b0d94d83 100644 --- a/cpp/common/test/rules/identifierhidden/IdentifierHidden.expected +++ b/cpp/common/test/rules/identifierhidden/IdentifierHidden.expected @@ -15,5 +15,4 @@ | test.cpp:142:9:142:10 | a1 | Declaration is hiding declaration $@. | test.cpp:140:14:140:15 | a1 | a1 | | test.cpp:147:9:147:10 | a2 | Declaration is hiding declaration $@. | test.cpp:145:20:145:21 | a2 | a2 | | test.cpp:152:9:152:10 | a3 | Declaration is hiding declaration $@. | test.cpp:150:17:150:18 | a3 | a3 | -| test.cpp:158:9:158:10 | a4 | Declaration is hiding declaration $@. | test.cpp:156:14:156:15 | a4 | a4 | | test.cpp:164:9:164:10 | a5 | Declaration is hiding declaration $@. | test.cpp:162:13:162:14 | a5 | a5 | diff --git a/cpp/common/test/rules/identifierhidden/test.cpp b/cpp/common/test/rules/identifierhidden/test.cpp index 946063e6b..ede4bb24d 100644 --- a/cpp/common/test/rules/identifierhidden/test.cpp +++ b/cpp/common/test/rules/identifierhidden/test.cpp @@ -155,7 +155,7 @@ void f8() { const int &a4 = a3; auto lambda4 = []() { - int a4 = a4 + 1; // NON_COMPLIANT - Lambda can access + int a4 = a4 + 1; // NON_COMPLIANT[FALSE_NEGATIVE] - Lambda can access // reference initialized with constant expression. };