summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/offsetof.cpp
blob: f0290e889a298f9ba4195404b1372acd6d016564 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// RUN: clang-cc -fsyntax-only -verify %s -Winvalid-offsetof

struct NonPOD {
  virtual void f();
  int m;
};

struct P {
  NonPOD fieldThatPointsToANonPODType;
};

void f() {
  int i = __builtin_offsetof(P, fieldThatPointsToANonPODType.m); // expected-warning{{offset of on non-POD type 'struct P'}}
}

OpenPOWER on IntegriCloud