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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [template/] [init8.C] - Blame information for rev 696

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

Line No. Rev Author Line
1 693 jeremybenn
// PR c++/36089
2
// { dg-do run }
3
 
4
extern "C" void abort ();
5
 
6
int f ()
7
{
8
  const int c(2);
9
  int d[c] = { 0, 0 };
10
  return d[0] + sizeof d;
11
}
12
 
13
struct A
14
{
15
  static int f ()
16
  {
17
    const int c(2);
18
    int d[c] = { 0, 0 };
19
    return d[0] + sizeof d;
20
  }
21
};
22
 
23
template  struct B
24
{
25
  static int f ()
26
  {
27
    const int c = 2;
28
    int d[c] = { 0, 0 };
29
    return d[0] + sizeof d;
30
  }
31
};
32
 
33
template  struct C
34
{
35
  static int f ()
36
  {
37
    const int c(2);
38
    int d[c] = { 0, 0 };
39
    return d[0] + sizeof d;
40
  }
41
};
42
 
43
template  struct D
44
{
45
  static int f ()
46
  {
47
    const int e(2);
48
    const int c(e);
49
    int d[c] = { 0, 0 };
50
    return d[0] + sizeof d;
51
  }
52
};
53
 
54
int
55
main (void)
56
{
57
  int v = f ();
58
  if (v != 2 * sizeof (int))
59
    abort ();
60
  if (v != A::f ())
61
    abort ();
62
  if (v != B<6>::f ())
63
    abort ();
64
  if (v != C<0>::f ())
65
    abort ();
66
  if (v != D<1>::f ())
67
    abort ();
68
}

powered by: WebSVN 2.1.0

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