I hope it's a valid "auto". the code works if I write "int" instead of "auto". It might be related to Bug 43281 internal compiler error: in type_unification_real, at cp/pt.c:13486 template <typename T > void shuffle(const T& first, const T& last) { auto w = *first; } int main() { int b[5]; shuffle(&b[0],&b[4]); } g++-4.5 -v Using built-in specs. COLLECT_GCC=g++-4.5 COLLECT_LTO_WRAPPER=/home/rakadam/streamplusplus/local/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../configure --enable-languages=c,c++ --program-suffix=-4.5 --prefix=/home/rakadam/streamplusplus/src/third_party/gcc-trunk/build_gcc/../../../../local --enable-lto --disable-bootstrap --enable-gold Thread model: posix gcc version 4.5.0 20100306 (experimental) (GCC)
Yes, that's valid.
Author: jason Date: Mon Jun 20 14:39:53 2011 New Revision: 175212 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175212 Log: PR c++/43321 * semantics.c (describable_type): Remove. * cp-tree.h: Likewise. * decl.c (cp_finish_decl): Don't call it. * init.c (build_new): Likewise. * parser.c (cp_parser_omp_for_loop): Likewise. * pt.c (tsubst_decl): Likewise. (do_auto_deduction): If we fail in a template, try again at instantiation time. Added: trunk/gcc/testsuite/g++.dg/cpp0x/auto26.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/cp-tree.h trunk/gcc/cp/decl.c trunk/gcc/cp/init.c trunk/gcc/cp/parser.c trunk/gcc/cp/pt.c trunk/gcc/cp/semantics.c trunk/gcc/cp/typeck.c trunk/gcc/testsuite/ChangeLog
Fixed for 4.7.0.