2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.benjamin / typedef01.C
blob466b866eeed8fa34b67cec3c6628730f0efdc3d4
1 // { dg-do assemble  }
2 //980205 bkoz
4 //7.1.3 the typedef specifier
7 //p1
8 typedef int MILES, *KLICKSP;
9 MILES distance;
10 extern KLICKSP metricp;
12 //p2--can redefine to same type
13 typedef struct s { /* ... */ } s;
14 typedef int I;
15 typedef int I;
16 typedef I I;
18 //p3--cannot redefine to a different type in a given scope
19 class complex2 { /* ... */ };// { dg-error "" } .*
20 typedef int complex2;// { dg-error "" } .*
21 typedef int complex3;// { dg-error "" } .*
22 class complex3 { /* ... */ };// { dg-error "" } .*
25 //p4
27 4 A typedef-name that names a class is a class-name (_class.name_).   If
28   a  typedef-name is used 
29   1) following the class-key in an elaborated-type-specifier 
30   2) or in the class-head of a class declaration 
31   3) or is used as the identifier in the declarator for a
32   constructor or destructor  declaration 
33   the program is ill-formed.  [Example:
35 struct S {
36   S();
37   ~S();
40 typedef struct S T;
42 S a = T();                      // OK 
43 struct T * p;                   // { dg-error "" } using typedef after struct
45 //case01
46 typedef bool short;// { dg-error "" } .*