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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [abi/] [offsetof.C] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
// Test that we can refer to the address of a base member of a null pointer
2
// to get its offset.  The standard says that offsetof shall not be used on
3
// non-POD classes, but there seems to be no such restriction on the common
4
// implementation thereof.
5
 
6
// Yes, this is bad, naughty, evil code.  But it seems to be well-formed.
7
// So we'll just warn.
8
 
9
// { dg-do run }
10
 
11
struct A { int i; };
12
 
13
struct B: public A {
14
  virtual void f ();
15
};
16
 
17
struct C: public B { };
18
 
19
int main ()
20
{
21
  return ((unsigned long) &((C*)0)->i) != sizeof(void*); // { dg-warning "offsetof|invalid" "" }
22
}

powered by: WebSVN 2.1.0

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