------- Comment #11 from jason at gcc dot gnu dot org 2007-10-04 09:34 ------- decltype is the C++0x equivalent of the GCC typeof extension; if you replace the word "typeof" in the testcase with "decltype" and compile with -fstd=c++0x, the testcase will work as expected. Or you can use "__decltype" without having to enable C++0x mode.
decltype does not always return the same type as typeof: specifically, when applied to an lvalue expression which is not a simple id-expression, decltype gives a reference type. But as used in the testcase for this bug report, the result is the same. The other typeof bugs I mentioned can be found in the depends list for bug 12604. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11756