1f08c3bdfSopenharmony_cistatic int a = 1; // OK 2f08c3bdfSopenharmony_cistatic int b[2] = {1, 1}; // OK 3f08c3bdfSopenharmony_cistatic void c(void) {} 4f08c3bdfSopenharmony_ci 5f08c3bdfSopenharmony_cistruct A { 6f08c3bdfSopenharmony_ci int a; 7f08c3bdfSopenharmony_ci int b[2]; 8f08c3bdfSopenharmony_ci}; 9f08c3bdfSopenharmony_ci 10f08c3bdfSopenharmony_cistruct B { 11f08c3bdfSopenharmony_ci int c; 12f08c3bdfSopenharmony_ci struct A d; 13f08c3bdfSopenharmony_ci}; 14f08c3bdfSopenharmony_ci 15f08c3bdfSopenharmony_cistatic struct B d= {1, {1, {1, 1}}}; // OK 16f08c3bdfSopenharmony_cistatic struct B e= {a, {1, {1, 1}}}; // KO 17f08c3bdfSopenharmony_cistatic struct B f= {1, {a, {1, 1}}}; // KO 18f08c3bdfSopenharmony_cistatic struct B g= {1, {1, {a, 1}}}; // KO 19f08c3bdfSopenharmony_cistatic struct B h= {1, {1, {1, a}}}; // KO 20f08c3bdfSopenharmony_cistatic struct B i= {.c = 1, .d = {.a = 1, .b = {1, 1}}}; // OK 21f08c3bdfSopenharmony_cistatic struct B j= {.c = a, .d = {.a = 1, .b = {1, 1}}}; // KO 22f08c3bdfSopenharmony_cistatic struct B k= {.c = 1, .d = {.a = a, .b = {1, 1}}}; // KO 23f08c3bdfSopenharmony_cistatic struct B l= {.c = 1, .d = {.a = 1, .b = {a, 1}}}; // KO 24f08c3bdfSopenharmony_cistatic struct B m= {.c = 1, .d = {.a = 1, .b = {1, a}}}; // KO 25f08c3bdfSopenharmony_ci 26f08c3bdfSopenharmony_cistatic int n[] = {a, 1}; // KO 27f08c3bdfSopenharmony_cistatic int o[] = {1, a}; // KO 28f08c3bdfSopenharmony_cistatic int p[] = {[0] = a, [1] = 1}; // KO 29f08c3bdfSopenharmony_cistatic int q[] = {[0] = 1, [1] = a}; // KO 30f08c3bdfSopenharmony_ci 31f08c3bdfSopenharmony_cistatic void r(void) { 32f08c3bdfSopenharmony_ci int a = 0; 33f08c3bdfSopenharmony_ci int b = a; // OK 34f08c3bdfSopenharmony_ci} 35f08c3bdfSopenharmony_ci 36f08c3bdfSopenharmony_cistatic void s(void) { 37f08c3bdfSopenharmony_ci int a = 1; 38f08c3bdfSopenharmony_ci static int b = a; // KO 39f08c3bdfSopenharmony_ci} 40f08c3bdfSopenharmony_ci 41f08c3bdfSopenharmony_ci/* 42f08c3bdfSopenharmony_ci * check-name: constexprness static storage object initializer 43f08c3bdfSopenharmony_ci * check-command: sparse -Wconstexpr-not-const $file 44f08c3bdfSopenharmony_ci * 45f08c3bdfSopenharmony_ci * check-error-start 46f08c3bdfSopenharmony_ciconstexpr-init.c:16:21: warning: non-constant initializer for static object 47f08c3bdfSopenharmony_ciconstexpr-init.c:17:25: warning: non-constant initializer for static object 48f08c3bdfSopenharmony_ciconstexpr-init.c:18:29: warning: non-constant initializer for static object 49f08c3bdfSopenharmony_ciconstexpr-init.c:19:32: warning: non-constant initializer for static object 50f08c3bdfSopenharmony_ciconstexpr-init.c:21:26: warning: non-constant initializer for static object 51f08c3bdfSopenharmony_ciconstexpr-init.c:22:40: warning: non-constant initializer for static object 52f08c3bdfSopenharmony_ciconstexpr-init.c:23:49: warning: non-constant initializer for static object 53f08c3bdfSopenharmony_ciconstexpr-init.c:24:52: warning: non-constant initializer for static object 54f08c3bdfSopenharmony_ciconstexpr-init.c:26:19: warning: non-constant initializer for static object 55f08c3bdfSopenharmony_ciconstexpr-init.c:27:22: warning: non-constant initializer for static object 56f08c3bdfSopenharmony_ciconstexpr-init.c:28:25: warning: non-constant initializer for static object 57f08c3bdfSopenharmony_ciconstexpr-init.c:29:34: warning: non-constant initializer for static object 58f08c3bdfSopenharmony_ciconstexpr-init.c:38:24: warning: non-constant initializer for static object 59f08c3bdfSopenharmony_ci * check-error-end 60f08c3bdfSopenharmony_ci */ 61