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

16 lines
304 B
C++
Raw Normal View History

2009-05-04 05:22:18 +08:00
// 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'}}
}