FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.benjamin / typedef01.C
blobba6af18b632eab96f47bc67ccfa7b038b00a1b9c
1 // Build don't link:
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 { /* ... */ };// ERROR - .*
20 typedef int complex2;// ERROR - .*
21 typedef int complex3;// ERROR - .*
22 class complex3 { /* ... */ };// 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;                   // ERROR - using typedef after struct
45 //case01
46 typedef bool short;// ERROR - .*