xref: /llvm-project/clang/test/SemaCXX/offsetof.cpp (revision 110c800cee78255a104e605b78e45b1a677a5ea9)
1 // FIXME: This test fails on 32-bit platforms? Investigate.
2 
3 // RUNX: clang-cc -fsyntax-only -verify %s -Winvalid-offsetof
4 
5 struct NonPOD {
6   virtual void f();
7   int m;
8 };
9 
10 struct P {
11   NonPOD fieldThatPointsToANonPODType;
12 };
13 
14 void f() {
15   int i = __builtin_offsetof(P, fieldThatPointsToANonPODType.m); // expected-warning{{offset of on non-POD type 'struct P'}}
16 }
17 
18