typedef-redecl.cpp revision 66973121788ca645fe3d4a66179b9cfb6f2bce08
1// RUN: clang -fsyntax-only -verify %s
2typedef int INT;
3typedef INT REALLY_INT; // expected-note {{previous definition is here}}
4typedef REALLY_INT REALLY_REALLY_INT;
5typedef REALLY_INT BOB;
6typedef float REALLY_INT; // expected-error{{typedef redefinition with different types ('float' vs 'INT')}}
7
8struct X {
9  typedef int result_type; // expected-note {{previous definition is here}}
10  typedef INT result_type; // expected-error {{redefinition of 'result_type'}}
11};
12
13struct Y; // expected-note{{previous definition is here}}
14typedef int Y;  // expected-error{{typedef redefinition with different types ('int' vs 'struct Y')}}
15
16typedef int Y2; // expected-note{{previous definition is here}}
17struct Y2; // expected-error{{definition of type 'struct Y2' conflicts with typedef of the same name}}
18
19void f(); // expected-note{{previous definition is here}}
20typedef int f; // expected-error{{redefinition of 'f' as different kind of symbol}}
21
22typedef int f2; // expected-note{{previous definition is here}}
23void f2(); // expected-error{{redefinition of 'f2' as different kind of symbol}}
24
25typedef struct s s;
26typedef int I;
27typedef int I;
28typedef I I;
29
30struct s { };
31
32typedef class st { /* ... */ } st; // expected-note{{previous use is here}}
33struct st; // expected-error{{use of 'st' with tag type that does not match previous declaration}}
34