]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/SemaCXX/offsetof-0x.cpp
Vendor import of clang trunk r162107:
[FreeBSD/FreeBSD.git] / test / SemaCXX / offsetof-0x.cpp
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -fsyntax-only -std=c++11 -verify %s -Winvalid-offsetof
2
3 struct NonPOD {
4   virtual void f();
5   int m;
6 };
7
8 struct P {
9   NonPOD fieldThatPointsToANonPODType;
10 };
11
12 void f() {
13   int i = __builtin_offsetof(P, fieldThatPointsToANonPODType.m); // expected-warning{{offset of on non-standard-layout type 'P'}}
14 }
15
16 struct StandardLayout {
17   int x;
18   StandardLayout() {}
19 };
20 int o = __builtin_offsetof(StandardLayout, x); // no-warning