blob: 1bcda1253d1b1690a09f173fe180875cef051507 (
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
// PR c++/36089
// { dg-do run }
extern "C" void abort ();
int f ()
{
const int c(2);
int d[c] = { 0, 0 };
return d[0] + sizeof d;
}
struct A
{
static int f ()
{
const int c(2);
int d[c] = { 0, 0 };
return d[0] + sizeof d;
}
};
template <int> struct B
{
static int f ()
{
const int c = 2;
int d[c] = { 0, 0 };
return d[0] + sizeof d;
}
};
template <int> struct C
{
static int f ()
{
const int c(2);
int d[c] = { 0, 0 };
return d[0] + sizeof d;
}
};
template <int> struct D
{
static int f ()
{
const int e(2);
const int c(e);
int d[c] = { 0, 0 };
return d[0] + sizeof d;
}
};
int
main (void)
{
int v = f ();
if (v != 2 * sizeof (int))
abort ();
if (v != A::f ())
abort ();
if (v != B<6>::f ())
abort ();
if (v != C<0>::f ())
abort ();
if (v != D<1>::f ())
abort ();
}
|