Open fjatWbyT opened 1 month ago
Add an additional omission case for type members declared with using aliases. This is motivated by the many A14-5-2
alerts overall produced in STL-like libraries (out of which, I've estimated an 80% of them to be false positives).
For example, I measured 1988 A14-5-2
alerts in abseil-cpp including false positives in aliases such as the ones starting at this line, and reduced it to 1540 with this strategy.
I was happy to see that current unit tests would finely do to capture the impact:
using T1 = typename template_base<T>::type; // COMPLIANT[FALSE_POSITIVE]
using T2 = typename template_base<int>::type; // NON_COMPLIANT
would become
using T1 = typename template_base<T>::type; // COMPLIANT
using T2 = typename template_base<int>::type; // NON_COMPLIANT[FALSE_NEGATIVE]
Affected rules
A14-5-2
Description
Type member defined with a dependent name and template parameter results in recommendation to be defined in a separated class because it is identified to be not dependent on the template parameter.
Example
Query
cpp/autosar/src/rules/A14-5-2/NonTemplateMemberDefinedInTemplate.ql
outputs thatanother_template_struct::type
does not use any of the template arguments ofanother_template_struct
.