brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · d5b8492 Raw
51 lines · c
1// RUN: %clang_cc1 -std=c23 -fsyntax-only -verify=c %s2// RUN: %clang_cc1 -fsyntax-only -verify=cpp -x c++ -Wno-c23-extensions %s3 4 5struct S {6  int arr[3];7};8 9struct S1 {10  struct S s;11};12 13void cases(int x) {14  int a[8] = {x, x, x, x, x, x,15#embed __FILE__16    // c-warning@-1{{excess elements in array initializer}}17    // cpp-error@-2{{excess elements in array initializer}}18};19  int b[8] = {20#embed __FILE__21    // c-warning@-1{{excess elements in array initializer}}22    // cpp-error@-2{{excess elements in array initializer}}23};24  int c[3000] = {x, x, x, x, x, x,25#embed __FILE__26  };27 char d[3] = {28#embed __FILE__29    // c-warning@-1{{initializer-string for char array is too long}}30    // cpp-error@-2{{initializer-string for char array is too long}}31  };32 33char e[3000] = { 1,34#embed __FILE__35};36 37struct S s = {38#embed __FILE__39    // c-warning@-1{{excess elements in struct initializer}}40    // cpp-error@-2{{excess elements in struct initializer}}41  , x42};43 44struct S1 s1 = {45#embed __FILE__46    // c-warning@-1{{excess elements in struct initializer}}47    // cpp-error@-2{{excess elements in struct initializer}}48  , x49};50}51