From 3bfcc240c7c68fd3aff8535df4e9e8e384eb9205 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 4 May 2025 21:25:46 +0900 Subject: fix forward struct decl --- tests/036.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/036.sh (limited to 'tests') diff --git a/tests/036.sh b/tests/036.sh new file mode 100644 index 0000000..2a60cf9 --- /dev/null +++ b/tests/036.sh @@ -0,0 +1,27 @@ +set -e + +cat <<'EOF' > expected +42 +EOF +bash ../../test_diff.sh <<'EOF' +void* calloc(); +int printf(); + +struct T; + +struct S { + struct T* a; +}; + +struct T { + int b; +}; + +int main() { + struct S* s = calloc(1, sizeof(struct S)); + s->a = calloc(1, sizeof(struct T)); + s->a->b = 42; + printf("%d\n", s->a->b); + return 0; +} +EOF -- cgit v1.2.3-70-g09d2