OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [warn/] [Wunused-local-typedefs.C] - Blame information for rev 701

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// Origin PR c++/33255
2
// { dg-options "-Wunused-local-typedefs" }
3
// { dg-do compile }
4
 
5
void
6
test_warn()
7
{
8
  typedef int foo; // { dg-warning "locally defined but not used" }
9
}
10
 
11
struct S
12
{
13
    typedef int T;
14
    S() {}
15
    S(int) {}
16
};
17
 
18
template
19
struct ST
20
{
21
    typedef T type;
22
    ST (int) {}
23
    ST () {}
24
};
25
 
26
template
27
void
28
test0_tmpl(void)
29
{
30
    typedef struct ST foo;
31
    foo(2);
32
}
33
 
34
int
35
test0(void)
36
{
37
    test0_tmpl();
38
}
39
 
40
void
41
test1(void)
42
{
43
    typedef int foo;
44
    ST a;
45
}
46
 
47
 
48
int
49
test2(void)
50
{
51
    typedef S foo;
52
    foo::T i = 0;
53
    return i;
54
}
55
 
56
template
57
void
58
test3_tmpl(void)
59
{
60
    typedef struct ST foo;
61
    ST v;
62
    const foo &var = v;
63
}
64
 
65
void
66
test3(void)
67
{
68
    test3_tmpl();
69
}
70
 
71
void
72
test4(void)
73
{
74
  typedef int foo;
75
  int vec[1] = {sizeof (foo)};
76
}
77
 
78
void
79
test5(void)
80
{
81
  typedef int T0;
82
  typedef char T1;
83
  typedef int* T2;
84
  typedef unsigned T3;
85
  struct C0 { virtual void f(void) {}};
86
  struct C1 : C0 {};
87
  typedef C0 T4;
88
 
89
  int v0 = (T0) 2;
90
  char v1 = static_cast (0);
91
  reinterpret_cast (&v0);
92
  unsigned* const c = 0;
93
  unsigned* v2 = const_cast (c);
94
  C0 *p0 = 0;
95
  C1 *p1 = 0;
96
  p0 = dynamic_cast (p1);
97
}
98
 
99
void
100
test6(void)
101
{
102
  struct C0 {};
103
  typedef C0 foo;
104
  C0 *v = new foo;
105
}
106
 
107
template
108
struct S7
109
{
110
  void
111
  f()
112
  {
113
    typedef int foo;
114
    sizeof(foo);
115
  }
116
};
117
 
118
template
119
void
120
test7(void)
121
{
122
  typedef typename ST::T bar; // { dg-warning "locally defined but not used" }
123
  typedef typename ST::T foo; // We shouldn't warn for this one, as
124
                                 // it's used below.
125
  S7 v;
126
}
127
 
128
 
129
template
130
void
131
test8(void)
132
{
133
  int f(S7);
134
  void g(int);
135
  typedef T foo;
136
  g(f(S7()));
137
}
138
 
139
int
140
test9(void)
141
{
142
  struct s { typedef int foo;}; // { dg-warning "locally defined but not used" }
143
  struct t { typedef int bar;};
144
  t::bar b = 0;
145
  return b;
146
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.