Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Sema / merge-decls.c
blob652cd8fd2454b066c4ddbca55d27297a5317faab
1 // RUN: %clang_cc1 %s -verify -fsyntax-only -Wno-strict-prototypes
3 void foo(void);
4 void foo(void) {}
5 void foo(void);
6 void foo(void); // expected-note {{previous declaration is here}}
8 void foo(int); // expected-error {{conflicting types for 'foo'}}
10 int funcdef()
12 return 0;
15 int funcdef();
17 int funcdef2() { return 0; } // expected-note {{previous definition is here}}
18 int funcdef2() { return 0; } // expected-error {{redefinition of 'funcdef2'}}
20 // PR2502
21 void (*f)(void);
22 void (*f)() = 0;
24 typedef __attribute__(( ext_vector_type(2) )) int Vi2;
25 typedef __attribute__(( ext_vector_type(2) )) float Vf2;
27 Vf2 g0; // expected-note {{previous definition is here}}
28 Vi2 g0; // expected-error {{redefinition of 'g0'}}
30 _Complex int g1; // expected-note {{previous definition is here}}
31 _Complex float g1; // expected-error {{redefinition of 'g1'}}
33 extern char i6096412[10];
34 extern char i6096412[];
35 void foo6096412(void) {
36 int x = sizeof(i6096412);
40 typedef int test1_IA[];
41 typedef int test1_A10[10];
42 static test1_A10 *test1_f(void);
43 void test1_g(void)
46 extern test1_IA *test1_f(void);
48 (void)sizeof(*test1_f());
51 typedef int test2_IA[];
52 typedef int test2_A10[10];
54 static test2_A10 *test2_f(void);
55 static test2_IA *test2_f(void);
57 void test2_g(void)
59 (void)sizeof(*test2_f());
62 int (*test3_f())[10];
63 int (*test3_f())[];
64 int test3_k = sizeof(*test3_f());
66 void test4_f(int);
67 void test4_f(a)
68 char a;
70 int v[sizeof(a) == 1 ? 1 : -1];
73 int test5_f(int (*)[10]);
74 int test5_f(int (*x)[]) {
75 return sizeof(*x); // expected-error {{invalid application of 'sizeof' to an incomplete type 'int[]'}}
78 void test6_f(int (*a)[11]);
79 void test6_f(a)
80 int (*a)[];
82 void test6_g() {
83 int arr[10];
84 test6_f(&arr); // expected-warning {{incompatible pointer types passing 'int (*)[10]' to parameter of type 'int (*)[11]}}
87 void test7_f(int (*)[10]);
88 void test7_f(int (*)[]); // expected-note {{passing argument to parameter here}}
89 void test7_g() {
90 int x[5];
91 test7_f(&x); // expected-warning {{incompatible pointer types passing 'int (*)[5]' to parameter of type 'int (*)[10]}}
94 char d;
95 char test8_gh62447[d.undef == 8]; // expected-error {{member reference base type 'char' is not a structure or union}}
96 char test8_gh62447[d.undef == 4]; // expected-error {{member reference base type 'char' is not a structure or union}}