Affected rules
Description
A constexpr function only returns a compile-time constant when provided with compile-time constants as arguments. The query currently incorrectly considers constexpr functions to always return constants.
Example
This function should only be considerd
constexpr int add(int x, int y) {
return x + y;
}
void test(int p) {
int x = add(1,2); // NON_COMPLIANT - could be marked constexpr
int y = add(1,p); // COMPLIANT - cannot be marked constexpr
Affected rules
A7-1-2Description
A
constexprfunction only returns a compile-time constant when provided with compile-time constants as arguments. The query currently incorrectly considersconstexprfunctions to always return constants.Example
This function should only be considerd