Recently I installed newer version of Ubuntu Linux (20.04) and noticed it doesn't have GCC 6 anymore... I know my code compiled with GCC 7 already, but I was curious how much it would take to make it compile with GCC 8 or newer, and more recent versions of Clang.
GCC 7 to GCC 8
- Most important change is that for simple variable types, copying using memcpy() is now discouraged. Direct assignment should be used instead.
GCC 8 to GCC 9
- When returning a class that has same type as return type of a function, std::move() should not be explicitly used.
GCC 9 to GCC 10
- cstdint and stdexcept headers need to be explicitly included when using standard integer types or throwing run-time exceptions
GCC to Clang
- Clang use different options to disable warnings
- For example -Wlogical-op and -Wno-maybe-uninitialized are not supported
- Clang requires explicit copy constructor if there is copy assignment operator
- Clang requires explicit move constructor if there is move assignment operator
- Clang requires explicit virtual destructor, if class has virtual methods
- Clang requires "override" keyword for virtual methods that override existing method in derived class