Module Name: src Committed By: rillig Date: Tue Dec 21 23:12:21 UTC 2021
Modified Files: src/tests/usr.bin/xlint/lint1: msg_171.c Log Message: tests/lint: extend test for nested initializations To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_171.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/xlint/lint1/msg_171.c diff -u src/tests/usr.bin/xlint/lint1/msg_171.c:1.6 src/tests/usr.bin/xlint/lint1/msg_171.c:1.7 --- src/tests/usr.bin/xlint/lint1/msg_171.c:1.6 Tue Mar 23 18:40:50 2021 +++ src/tests/usr.bin/xlint/lint1/msg_171.c Tue Dec 21 23:12:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_171.c,v 1.6 2021/03/23 18:40:50 rillig Exp $ */ +/* $NetBSD: msg_171.c,v 1.7 2021/12/21 23:12:21 rillig Exp $ */ # 3 "msg_171.c" // Test for message: cannot assign to '%s' from '%s' [171] @@ -37,6 +37,27 @@ pointer_to_compound_literal(void) int y; }; struct point *p = &(struct point){ - 12, 5, + 12, 5, + }; + + /* + * A sizeof expression is another way to create nested + * initializations. + */ + struct point p2 = { + (int)sizeof(struct point){ + (int)sizeof(struct point){ + (int)sizeof(struct point){ + (int)sizeof(struct point){ + 0, + 0, + }, + 0, + }, + 0, + }, + 0, + }, + 0, }; }