aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.benjamin/typedef01.C
blob: 179740d556cf8986c9b1b3149d383b1e413afbf1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Build don't link:
//980205 bkoz

//7.1.3 the typedef specifier


//p1
typedef int MILES, *KLICKSP;
MILES distance;
extern KLICKSP metricp;

//p2--can redefine to same type
typedef struct s { /* ... */ } s;
typedef int I;
typedef int I;
typedef I I;

//p3--cannot redefine to a different type in a given scope
class complex2 { /* ... */ };// ERROR - .*
typedef int complex2;// ERROR - .*
typedef int complex3;// ERROR - .*
class complex3 { /* ... */ };// ERROR - .*


//p4
/*
4 A typedef-name that names a class is a class-name (_class.name_).   If
  a  typedef-name is used 
  1) following the class-key in an elaborated-type-specifier 
  2) or in the class-head of a class declaration 
  3) or is used as the identifier in the declarator for a
  constructor or destructor  declaration 
  the program is ill-formed.  [Example:
*/
struct S {
  S();
  ~S();
};

typedef struct S T;

S a = T();                      // OK 
struct T * p;                   // error

//case01
typedef bool short;// ERROR - .*