hanchenye-llvm-project/clang/test/SemaCXX/offsetof.cpp

16 lines
304 B
C++

// 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'}}
}