The attached preprocessed source makes the first release candidate of gcc-4.7 segfault, gcc-4.7.0 was fine. No additional compilation options are required. I have just spotted this and not begun to try to reduce the testcase.
Created attachment 27574 [details] Preprocessed source
Caused by http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188117 i.e. a very recent regression on 4.7 branch and trunk.
Created attachment 27575 [details] Reduced testcase
Even shorter (but invalid): template <bool T> struct C { }; template <typename T> struct E { static bool const value = true; }; template <typename T> int foo () { struct F; struct G { static int *(F::*bar ()) (T) { } }; enum { I = sizeof (C <((E <T>::value))> (G::bar ())) }; return 1; } int z = foo <int> ();
I think for 4.7.1 let's just revert that patch.
Yeah, I agree with that.
*** Bug 53620 has been marked as a duplicate of this bug. ***
Can someone please revert it on the branch at least? Thx.
Author: jason Date: Tue Jun 12 15:01:17 2012 New Revision: 188460 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188460 Log: PR c++/53599 Revert: PR c++/53137 * pt.c (instantiate_class_template_1): Set LAMBDA_EXPR_THIS_CAPTURE. (instantiate_decl): Don't push_to_top_level for local class methods. (instantiate_class_template_1): Or for local classes. Added: branches/gcc-4_7-branch/gcc/testsuite/g++.dg/template/local7.C Removed: branches/gcc-4_7-branch/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template5.C Modified: branches/gcc-4_7-branch/gcc/cp/ChangeLog branches/gcc-4_7-branch/gcc/cp/pt.c branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
Author: jason Date: Tue Jun 12 18:32:04 2012 New Revision: 188473 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188473 Log: PR c++/53599 * name-lookup.c (pushtag_1): Add a DECL_EXPR for a local class. * semantics.c (finish_cond): Build a COMPOUND_EXPR. * pt.c (tsubst_expr) [COMPOUND_EXPR]: Handle. [DECL_EXPR]: Don't call cp_finish_decl for an implicit typedef. Don't return the decl. Added: trunk/gcc/testsuite/g++.dg/template/local7.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/name-lookup.c trunk/gcc/cp/pt.c trunk/gcc/cp/semantics.c trunk/gcc/testsuite/ChangeLog
Fixed.
Author: jason Date: Wed Jun 20 07:21:40 2012 New Revision: 188809 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188809 Log: PR c++/53599 * pt.c (lookup_template_class_1): Use ts_global. Modified: branches/gcc-4_7-branch/gcc/cp/ChangeLog branches/gcc-4_7-branch/gcc/cp/pt.c branches/gcc-4_7-branch/gcc/testsuite/ChangeLog