summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/other/offsetof5.C
blob: 3c4843380553d46cff5a80cf1d95a38d3e24ac7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// PR c++/35741
// { dg-do compile }

#include <stddef.h>

struct A
{
  char c;
  int &i;
};

int j = offsetof (A, i);		// { dg-warning "invalid access|offsetof" }

template <typename T>
struct S
{
  T h;
  T &i;
  static const int j = offsetof (S, i);	// { dg-warning "invalid access|offsetof" }
};

int k = S<int>::j;			// { dg-message "instantiated from here" }