Skip to content

Commit 0b984b2

Browse files
authored
Merge branch 'main' into lcartey/essential-types
2 parents 4e477e9 + dcd22fd commit 0b984b2

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- `A13-5-2` - address a false positive where lambda expressions with empty captures were being flagged as having a non-compliant conversion operator.

cpp/autosar/src/rules/A13-5-2/UserDefinedConversionOperatorsNotDefinedExplicit.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ class ExplicitConversionOperator extends ConversionOperator {
2727
from ConversionOperator op
2828
where
2929
not isExcluded(op, OperatorsPackage::userDefinedConversionOperatorsNotDefinedExplicitQuery()) and
30-
not op instanceof ExplicitConversionOperator
30+
not op instanceof ExplicitConversionOperator and
31+
not op.isCompilerGenerated()
3132
select op, "User-defined conversion operator is not explicit."

cpp/autosar/test/rules/A13-5-2/test.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,15 @@ class A {
88
operator int() const { return d; } // NON_COMPLIANT
99
private:
1010
float d;
11-
};
11+
};
12+
13+
void test_compiler_generated() {
14+
int x = 0;
15+
16+
auto capture = [x]() -> int { return x; };
17+
18+
auto no_capture = []() -> int {
19+
int x = 1;
20+
return x;
21+
};
22+
}

0 commit comments

Comments
 (0)