Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation warning: initialization discards 'const' qualifier from pointer target type #512

Open
Tracked by #535
quarthex opened this issue Sep 28, 2023 · 0 comments

Comments

@quarthex
Copy link

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));
      |                             ^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant