Created attachment 23933 [details] Preprocessed broken_decltype.cpp Hello All, The following innocent-looking code crashes the compiler: template <typename T> struct Handle { Handle(T& t); }; template<class T> struct Class { struct Struct {} data; void f(); void g(); }; template<class T> void Class<T>::f() { Handle< decltype((data)) > handle(data); } template<class T> void Class<T>::g() { Handle< decltype((data)) > handle(data); } The command line and compiler output were: g++ -std=g++0x broken_decltype.cpp (see attachment for detailed flags) broken_decltype.cpp: In member function ‘void Class<T>::g()’: broken_decltype.cpp:21:30: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate This fails on multiple distributions including Linux 2.6.35.6-45.fc14.x86_64, GNU C++ (GCC) version 4.5.1 20100924 (Red Hat 4.5.1-4) (x86_64-redhat-linux) compiled by GNU C version 4.5.1 20100924 (Red Hat 4.5.1-4), GMP version 4.3.1, MPFR version 2.4.2, MPC version 0.8.1 Cheers! David.
seems to be fixed in 4.6
Indeed. I'm going to add the testcase to mainline and 4_6-branch and close the PR.
Author: paolo Date: Mon May 9 23:24:01 2011 New Revision: 173598 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173598 Log: 2011-05-09 Paolo Carlini <paolo.carlini@oracle.com> PR c++/48522 * g++.dg/cpp0x/pr48522.C: New. Added: trunk/gcc/testsuite/g++.dg/cpp0x/pr48522.C Modified: trunk/gcc/testsuite/ChangeLog
Author: paolo Date: Mon May 9 23:24:21 2011 New Revision: 173599 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173599 Log: 2011-05-09 Paolo Carlini <paolo.carlini@oracle.com> PR c++/48522 * g++.dg/cpp0x/pr48522.C: New. Added: branches/gcc-4_6-branch/gcc/testsuite/g++.dg/cpp0x/pr48522.C Modified: branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Done.