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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [parse/] [offsetof9.C] - Blame information for rev 774

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

Line No. Rev Author Line
1 693 jeremybenn
/* PR c/32041 */
2
/* { dg-do run } */
3
 
4
struct S
5
{
6
  int c;
7
  struct { float f; } sa[2];
8
};
9
 
10
char a[__builtin_offsetof (S, sa->f)
11
       == __builtin_offsetof (S, sa[0].f) ? 1 : -1];
12
 
13
template 
14
struct T
15
{
16
  int c[N];
17
  struct { float f; } sa[N];
18
  static int foo () { return __builtin_offsetof (T, sa->f); }
19
  static int bar () { return __builtin_offsetof (T, sa[0].f); }
20
};
21
 
22
char b[__builtin_offsetof (T<5>, sa->f)
23
       == __builtin_offsetof (T<5>, sa[0].f) ? 1 : -1];
24
 
25
int
26
main ()
27
{
28
  if (T<1>::foo () != T<1>::bar ())
29
    __builtin_abort ();
30
  if (T<7>::foo () != T<7>::bar ())
31
    __builtin_abort ();
32
}

powered by: WebSVN 2.1.0

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