OSDN Git Service

PR c++/15759
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / other / offsetof3.C
1 /* Verify that offsetof warns if given a non-POD */
2 /* Copyright (C) 2003 Free Software Foundation, Inc. */
3 /* Contributed by Matt Austern <austern@apple.com> 15 May 2003 */
4 /* { dg-do compile } */
5
6 struct X
7 {
8   X() : x(3), y(4) { }
9   int x, y;
10 };
11
12 typedef X* pX;
13 typedef __SIZE_TYPE__ size_t;
14
15 size_t yoff = size_t(&(pX(0)->y)); /* { dg-warning "invalid access" "" } */
16 /* { dg-warning "macro was used incorrectly" "macro" { target *-*-* } 15 } */