Home
tests/cc: Don't use compound literal in file scope struct initializer - scc - simple c99 compiler HTML git clone git://git.simple-cc.org/scc DIR Log DIR Files DIR Refs DIR Submodules DIR README DIR LICENSE --- DIR commit 304a60f868d56b3a9fc6925d957526899ae55eb6 DIR parent 1d8969baa52c6ee8981869fd67c8c22cd0707fad HTML 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: M tests/cc/execute/0161-struct.c | 2 +- M tests/cc/execute/0165-struct.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- DIR 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() DIR 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,