commit 304a60f868d56b3a9fc6925d957526899ae55eb6
parent 1d8969baa52c6ee8981869fd67c8c22cd0707fad
Author: Michael Forney <mforney@mforney.org>
Date: Mon, 25 Mar 2024 23:43:29 -0700
tests/cc: Don't use compound literal in file scope struct initializer
Compound literal expressions are not necessarily constant expressions.
Diffstat:
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/cc/execute/0161-struct.c b/tests/cc/execute/0161-struct.c
@@ -1,5 +1,5 @@
struct S { int a; int b; };
-struct S s = (struct S){1, 2};
+struct S s = {1, 2};
int
main()
diff --git a/tests/cc/execute/0165-struct.c b/tests/cc/execute/0165-struct.c
@@ -7,7 +7,7 @@ struct S2 {
struct S1 *ps1;
int arr[2];
};
-struct S1 gs1 = (struct S1) {.a = 1, 2};
+struct S1 gs1 = {.a = 1, 2};
struct S2 *s = &(struct S2) {
{.b = 2, .a = 1},
&gs1,