blob: 4a4612be0dc9edfbea46521768edc9a593da013a [file] [log] [blame]
Ben Murdoch097c5b22016-05-18 11:27:45 +01001// Copyright (c) 2012 Google Inc. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#define offsetof(st, m) ((unsigned)((char*)&((st*)0)->m - (char*)0))
6
7struct MyStruct {
8 virtual void MyFunc() = 0;
9 int my_member;
10};
11
12int main() {
13 unsigned x = offsetof(MyStruct, my_member);
14 return x ? 0 : 1;
15}