brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 7bf9fda Raw
97 lines · c
1// RUN: %clang_cc1 %s -verify -fsyntax-only -Wno-strict-prototypes2 3void foo(void);4void foo(void) {} 5void foo(void);6void foo(void); // expected-note {{previous declaration is here}}7 8void foo(int); // expected-error {{conflicting types for 'foo'}}9 10int funcdef()11{12 return 0;13}14 15int funcdef();16 17int funcdef2() { return 0; } // expected-note {{previous definition is here}}18int funcdef2() { return 0; } // expected-error {{redefinition of 'funcdef2'}}19 20// PR250221void (*f)(void);22void (*f)() = 0;23 24typedef __attribute__(( ext_vector_type(2) )) int Vi2;25typedef __attribute__(( ext_vector_type(2) )) float Vf2;26 27Vf2 g0; // expected-note {{previous definition is here}}28Vi2 g0; // expected-error {{redefinition of 'g0'}}29 30_Complex int g1; // expected-note {{previous definition is here}}31_Complex float g1; // expected-error {{redefinition of 'g1'}}32 33extern char i6096412[10];34extern char i6096412[];35void foo6096412(void) {36  int x = sizeof(i6096412);37}38 39 40typedef int test1_IA[];41typedef int test1_A10[10];42static test1_A10 *test1_f(void);43void test1_g(void)44{45  {46    extern test1_IA  *test1_f(void);47  }48  (void)sizeof(*test1_f());49}50 51typedef int test2_IA[];52typedef int test2_A10[10];53 54static test2_A10 *test2_f(void);55static test2_IA  *test2_f(void);56 57void test2_g(void)58{59  (void)sizeof(*test2_f());60}61 62int (*test3_f())[10];63int (*test3_f())[];64int test3_k = sizeof(*test3_f());65 66void test4_f(int);67void test4_f(a)68  char a;69{70  int v[sizeof(a) == 1 ? 1 : -1];71}72 73int test5_f(int (*)[10]);74int test5_f(int (*x)[]) {75  return sizeof(*x); // expected-error {{invalid application of 'sizeof' to an incomplete type 'int[]'}}76}77 78void test6_f(int (*a)[11]);79void test6_f(a)80   int (*a)[];81{}82void test6_g() {83  int arr[10];84  test6_f(&arr); // expected-error {{incompatible pointer types passing 'int (*)[10]' to parameter of type 'int (*)[11]}}85}86 87void test7_f(int (*)[10]);88void test7_f(int (*)[]); // expected-note {{passing argument to parameter here}}89void test7_g() {90  int x[5];91  test7_f(&x); // expected-error {{incompatible pointer types passing 'int (*)[5]' to parameter of type 'int (*)[10]}}92}93 94char d;95char test8_gh62447[d.undef == 8]; // expected-error {{member reference base type 'char' is not a structure or union}}96char test8_gh62447[d.undef == 4]; // expected-error {{member reference base type 'char' is not a structure or union}}97