Peng asked:
Can somebody
let me know if the following code can be compiled by a more recent
version of gcc or some other compiler?

The gcc folks themselves use the EDG front end to check bug reports against gcc/g++. The EDG front end is used by Intel's ICC compiler and many others. There is a great online service  through which you can try your code against this compiler: http://www.comeaucomputing.com/tryitout/

I heavily use this Comeau service, not only for actual gcc bugs (I've reported a ton) but also to make progress when the bug is between my ears and gcc is not being helpful. The EDG diagnostic quality is way beyond gcc - they even do a better job of the cryptic error message stacks from template metaprogramming.

Ivan