Skip to content

Commit 9f46766

Browse files
committed
Rule 7.0.3: Split unevaluated operands test case
Make it clearer that a static_assert is not unevaluated.
1 parent 189f8c0 commit 9f46766

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

cpp/misra/test/rules/RULE-7-0-3/NoCharacterNumericalValue.expected

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@
1616
| test.cpp:53:7:53:8 | l1 | Conversion of character type 'char' to 'bool' uses numerical value of character. |
1717
| test.cpp:55:8:55:9 | l2 | Conversion of character type 'char' to 'bool' uses numerical value of character. |
1818
| test.cpp:73:39:73:41 | 97 | Conversion of character type 'char' to 'int_type' uses numerical value of character. |
19-
| test.cpp:89:8:89:9 | l1 | Conversion of character type 'char' to 'int' uses numerical value of character. |
20-
| test.cpp:89:14:89:16 | 48 | Conversion of character type 'char' to 'int' uses numerical value of character. |
21-
| test.cpp:89:23:89:24 | l1 | Conversion of character type 'char' to 'int' uses numerical value of character. |
22-
| test.cpp:89:29:89:31 | 57 | Conversion of character type 'char' to 'int' uses numerical value of character. |
23-
| test.cpp:102:25:102:26 | l1 | Conversion of character type 'char' to 'int' uses numerical value of character. |
24-
| test.cpp:117:15:117:16 | l2 | Conversion of character type 'int_type' to 'char' uses numerical value of character. |
25-
| test.cpp:123:31:123:32 | 65 | Conversion of character type 'int' to 'char' uses numerical value of character. |
26-
| test.cpp:124:29:124:31 | 65 | Conversion of character type 'char' to 'int' uses numerical value of character. |
27-
| test.cpp:130:6:130:7 | l2 | Conversion of character type 'char' to 'int' uses numerical value of character. |
19+
| test.cpp:84:17:84:19 | 120 | Conversion of character type 'char' to 'int' uses numerical value of character. |
20+
| test.cpp:90:8:90:9 | l1 | Conversion of character type 'char' to 'int' uses numerical value of character. |
21+
| test.cpp:90:14:90:16 | 48 | Conversion of character type 'char' to 'int' uses numerical value of character. |
22+
| test.cpp:90:23:90:24 | l1 | Conversion of character type 'char' to 'int' uses numerical value of character. |
23+
| test.cpp:90:29:90:31 | 57 | Conversion of character type 'char' to 'int' uses numerical value of character. |
24+
| test.cpp:103:25:103:26 | l1 | Conversion of character type 'char' to 'int' uses numerical value of character. |
25+
| test.cpp:118:15:118:16 | l2 | Conversion of character type 'int_type' to 'char' uses numerical value of character. |
26+
| test.cpp:124:31:124:32 | 65 | Conversion of character type 'int' to 'char' uses numerical value of character. |
27+
| test.cpp:125:29:125:31 | 65 | Conversion of character type 'char' to 'int' uses numerical value of character. |
28+
| test.cpp:131:6:131:7 | l2 | Conversion of character type 'char' to 'int' uses numerical value of character. |

cpp/misra/test/rules/RULE-7-0-3/test.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ void test_optional_comparison() {
8080
}
8181

8282
void test_unevaluated_operand() {
83-
decltype('s' + 't') l1; // COMPLIANT
84-
static_assert(sizeof('x') > 0); // COMPLIANT
83+
decltype('s' + 't') l1; // COMPLIANT
84+
static_assert('x' > 0); // NON_COMPLIANT
85+
sizeof('x'); // COMPLIANT
8586
}
8687

8788
void test_range_check_non_compliant() {

0 commit comments

Comments
 (0)