Criterion
Criterion copied to clipboard
Compilation warning: `initialization discards 'const' qualifier from pointer target type`
Good day,
On array types, Criterion expect the terms to be mutable. The framework should handle the case of constant arrays.
Criterion version: 2.4.2 GCC: 13.2.0
#include <criterion/criterion.h>
#include <criterion/new/assert.h>
Test(test, test) {
const int a[] = {0};
const int b[] = {0};
cr_expect(eq(int[1], a, b));
}
test.c: In function 'test_test_impl':
test.c:7:30: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
7 | cr_expect(eq(int[1], a, b));
| ^
test.c:7:33: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
7 | cr_expect(eq(int[1], a, b));
| ^