Summary
I am trying to compile an old C++ application on a new AIX 7 box with the AIX 11.1 compiler. This application uses offsetof on non POD classes.
I set the langlvl option to strict98 and also set the option for "offsetnonpod", which tells the compiler to allow offsetof on non-POD classes.
I get the same error if I remove the offsetnonpod setting and use extended for langlvl. It seems I must be doing something wrong with specifying the offsetnonpod option or the compiler doesn't actually support such functionality.
Example code
#include <iostream>
struct Foo
{
private:
int x;
};
int main()
{
std::cout << offsetof(Foo, x);
return 0;
}
And I build with this command:
xlc++_r -qlanglvl=offsetnonpod -qlanglvl=strict98 test.cpp
And I get this:
"test.cpp", line 11.32: 1540-0287 (S) "offsetof" must not be applied to "struct Foo". It is not a POD (plain old data) type.