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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [variadic-init.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do run }
2
// { dg-options "-std=gnu++0x" }
3
 
4
// PR c++/33510
5
#define SIZE_FROM_CTOR
6
extern "C" void abort ();
7
 
8
template struct pair
9
{
10
  int i, j;
11
  pair () : i (M), j (N) {}
12
};
13
 
14
template struct S
15
{
16
  template static int *foo ()
17
  {
18
#ifdef SIZE_FROM_CTOR
19
    static int x[] = { (M + N)..., -1 };
20
#else
21
    static int x[1 + sizeof... N] = { (M + N)..., -1 };
22
#endif
23
    return x;
24
  }
25
};
26
 
27
template struct R
28
{
29
  template static int *foo ()
30
  {
31
#ifdef SIZE_FROM_CTOR
32
    static int x[] = { (sizeof(M) + sizeof(N))..., -1 };
33
#else
34
    static int x[1 + sizeof... N] = { (sizeof(M) + sizeof(N))..., -1 };
35
#endif
36
    return x;
37
  }
38
};
39
 
40
int *bar ()
41
{
42
  return S<0, 1, 2>::foo<0, 1, 2> ();
43
}
44
 
45
int *baz ()
46
{
47
  return R::foo ();
48
}
49
 
50
 
51
int main ()
52
{
53
  int *p = bar ();
54
  if (p[0] != 0 || p[1] != 2 || p[2] != 4 || p[3] != -1)
55
    abort ();
56
}

powered by: WebSVN 2.1.0

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