Thanks a lot JLBorges. While I add the above code, it gives me below errors.
[Error] 'is_trivially_copyable' is not a member of 'std'
[Error] expected primary-expression before 'decltype'
[Error] expected ',' before 'decltype'
[Error] expected string-literal before 'decltype'
[Error] expected ')' before 'decltype'
My GCC version is < 5 do not support std::is_trivially_copyable from the C++11 standard. are there any other work arounds?
> My GCC version is < 5 do not support std::is_trivially_copyable from the C++11 standard.
> are there any other work arounds?
It is an ancient version of the compiler.
Just comment out the lines with static_assert .
Verify manually that the types involved are trivially copyable.
Somewhat simplified;
verify that the types involved (types of imghdr, imginfoHdr etc.) are plain C-style structs (structs that a C program would not complain about), and that they do not have pointers as members.