view gcc/testsuite/g++.dg/ext/builtin-offsetof3.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
line wrap: on
line source

// PR c++/85061
// { dg-do compile }

struct B { int a, b; };
struct A
{
  static int x[2];
  static int y;
  static B z;
};

int i = __builtin_offsetof (volatile A, x[0]);	// { dg-error "cannot apply 'offsetof' to static data member 'A::x'" }
int j = __builtin_offsetof (volatile A, y);	// { dg-error "cannot apply 'offsetof' to static data member 'A::y'" }
int k = __builtin_offsetof (volatile A, z.a);	// { dg-error "cannot apply 'offsetof' to a non constant address" }