#include <iostream> using namespace std; struct structure __attribute__ (packed) { char a; int b; char c; }; int main() { std::cout << sizeof(struct structure) << '\n'; return 0; }
Standard input is empty
prog.cpp:4:33: error: expected ‘(’ before ‘packed’ struct structure __attribute__ (packed) { ^ prog.cpp:4:41: error: expected ‘)’ before ‘{’ token struct structure __attribute__ (packed) { ^ prog.cpp:4:8: warning: attribute ignored in declaration of ‘struct structure’ [-Wattributes] struct structure __attribute__ (packed) { ^ prog.cpp:4:8: note: attribute for ‘struct structure’ must follow the ‘struct’ keyword prog.cpp: In function ‘int main()’: prog.cpp:12:38: error: invalid application of ‘sizeof’ to incomplete type ‘structure’ std::cout << sizeof(struct structure) << '\n'; ^
Standard output is empty