...
| Code Block | ||||
|---|---|---|---|---|
| ||||
#include <cstddef>
struct D {
virtual void f() {}
struct InnerStandardLayout {
int i;
} Innerinner;
};
void f() {
size_t off = offsetof(D::InnerStandardLayout, i);
// ...
} |
...
The noncompliant code example does not emit a diagnostic when compiled with the /Wall switch in Microsoft Visual Studio 2013 2015 on x86, resulting in off being a large value, likely representing the offset between the null pointer address 0 and the address of the static variable S::i.
...