Debian Codegraph @

clang/test/SemaCXX/offsetof-0x.cpp

raw
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -fsyntax-only -std=c++11 -verify %s -Winvalid-offsetof
2 // RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -fsyntax-only -std=c++11 -verify %s -Winvalid-offsetof -fexperimental-new-constant-interpreter
3
4 struct NonPOD {
5 virtual void f();
6 int m;
7 };
8
9 struct P {
10 NonPOD fieldThatPointsToANonPODType;
11 };
12
13 void f() {
14 int i = __builtin_offsetof(P, fieldThatPointsToANonPODType.m); // expected-warning{{'offsetof' on non-standard-layout type 'P'}}
15 }
16
17 struct StandardLayout {
18 int x;
19 StandardLayout() {}
20 };
21 int o = __builtin_offsetof(StandardLayout, x); // no-warning