msg_292.c revision 1.3
1/* $NetBSD: msg_292.c,v 1.3 2022/02/27 18:51:21 rillig Exp $ */ 2# 3 "msg_292.c" 3 4// Test for message: cannot concatenate wide and regular string literals [292] 5 6const char c_c_c_w_w_w[] = 7 "c2" 8 "c 4" 9 "c 8" 10 /* expect+1: error: cannot concatenate wide and regular string literals [292] */ 11 L"w2" 12 /* expect+1: error: cannot concatenate wide and regular string literals [292] */ 13 L"w 4" 14 /* expect+1: error: cannot concatenate wide and regular string literals [292] */ 15 L"w 8"; 16/* The 15 results from 2 + 4 + 8 + '\0'. */ 17/* expect+1: error: negative array dimension (-15) [20] */ 18typedef int reveal_sizeof_c_c_c_w_w_w[-(int)sizeof(c_c_c_w_w_w)]; 19 20const char c_w_c_w_c_w[] = 21 "c2" 22 L"w2" 23 /* expect+1: error: cannot concatenate wide and regular string literals [292] */ 24 "c 4" 25 L"w 4" 26 /* expect+1: error: cannot concatenate wide and regular string literals [292] */ 27 "c 8" 28 /* expect+1: error: cannot concatenate wide and regular string literals [292] */ 29 L"w 8"; 30/* 31 * Concatenating L"w2" with "c4" fails, keeping L"w2". 32 * Concatenating L"w2" with L"w4" succeeds, resulting in L"w2w4". 33 * Concatenating L"w2w4" with "c8" fails, keeping L"w2w4". 34 * Concatenating L"w2w4" with L"w8" succeeds, resulting in L"w2w4w8". 35 * Concatenating "c2" with L"w2w4w8" fails, keeping "c2". 36 * The size of "c2" is 3. 37 */ 38/* expect+1: error: negative array dimension (-3) [20] */ 39typedef int reveal_sizeof_c_w_c_w_c_w[-(int)sizeof(c_w_c_w_c_w)]; 40