This doesn't look like it has to do with Qt4 or Q5, the compiler complains about auto.
But you can easily verify that by using "new int" instead.

What you need to ensure, however, is that the C++ compiler is aware of your usage of C++11/14.

For GCC that is the compiler flag -std=c++0x

Build system generators can have support for doing that correctly for each compiler they support, for example Qt5's qmake can do that by specifying
CONFIG += c++11

In CMake you can do
set(CMAKE_CXX_STANDARD 11)

Cheers,
_