Choose one of the GCC mirror sites, under ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/, choose the release version. For example, download gcc-4.8.3 from the release site

tar xzf gcc-4.8.3.tar.gz
cd gcc-4.8.3

GCC compiler requires GMP, MPFR and MPC libraries. Execute the following line:

./contrib/download_prerequisites

(Alternatively, you can download GMP, MPFR and MPC on your own, this is rather difficult. As I have never manage to succeed in this approach. )

cd ..
mkdir gcc-4.8.3-build
cd gcc-4.8.3-build
$PWD/../gcc-4.8.3/configure --prefix=$HOME/gcc-4.8.3
make
make install

‘g++’ is installed under ‘$HOME/gcc-4.8.3/bin’.

Now, under the home directory, add line export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/gcc-4.8.3/lib64 to .profile.