1 2 3 4 5 | struct nibbles { unsigned lo : 4; unsigned hi : 4; }; int main() { static_assert(alignof(nibbles) <= alignof(char),"Alignment of nibbles should not be stricter than char!"); } |
c3RydWN0IG5pYmJsZXMgeyB1bnNpZ25lZCBsbyA6IDQ7IHVuc2lnbmVkIGhpIDogNDsgfTsKCmludCBtYWluKCkgewoJc3RhdGljX2Fzc2VydChhbGlnbm9mKG5pYmJsZXMpIDw9IGFsaWdub2YoY2hhciksIkFsaWdubWVudCBvZiBuaWJibGVzIHNob3VsZCBub3QgYmUgc3RyaWN0ZXIgdGhhbiBjaGFyISIpOwp9
prog.cpp: In function 'int main()': prog.cpp:4:2: error: static assertion failed: "Alignment of nibbles should not be stricter than char!"
-
result: Compilation error (maybe you wish to see an example for C++11)


