Skip to content

Commit e1521ad

Browse files
committed
Add comment describing exclusion of compile time float literals
1 parent 9a9138a commit e1521ad

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cpp/autosar/src/rules/A5-1-1/LiteralValueUsedOutsideTypeInit.ql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ where
5353
not l = any(ArrayOrVectorAggregateLiteral aal).getAnElementExpr(_).getAChild*() and
5454
// Ignore x - 1 expressions
5555
not exists(SubExpr se | se.getRightOperand() = l and l.getValue() = "1") and
56+
// Exclude compile time computed integral literals as they can appear as integral literals
57+
// when used as non-type template arguments.
58+
// We limit ourselves to integral literals, because floating point literals as non-type
59+
// template arguments are not supported in C++ 14. Those are supported shince C++ 20.
5660
not l instanceof CompileTimeComputedIntegralLiteral and
5761
// Exclude literals to instantiate a class template per example in the standard
5862
// where an type of std::array is intialized with size 5.

0 commit comments

Comments
 (0)