I see an internal compiler error with the following code (reduced from actual production code that passes with g++-5.3.0). % cat log.ii template <typename F> struct Tag { static void fp() { f()(0); } static F f() {} }; struct Dispatch { template <typename F> Dispatch(F&&) : f(Tag<F>::fp) {} void (*f)(); }; struct Empty { Empty(Empty&&); }; struct Value { Value(); template <typename U> Value(U); void call(Dispatch); Empty e; }; struct EmptyValue { EmptyValue(EmptyValue&&); EmptyValue(); }; struct User { User() { Value().call([](Value) { return EmptyValue(); }); } }; User user; % g++ --std=c++11 -S log.ii log.ii: In static member function ‘static EmptyValue User::User()::<lambda(Value)>::_FUN(Value)’: log.ii:27:51: internal compiler error: in assign_temp, at function.c:961 Value().call([](Value) { return EmptyValue(); }); ^ log.ii:27:51: internal compiler error: Abort trap: 6 g++: internal compiler error: Abort trap: 6 (program cc1plus) Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions.
Started with r232168.
This looks like a C++ FE bug to me, the operator() method is called with TREE_ADDRESSABLE argument by value, rather than by reference. Normally, when the C++ FE goes through build_over_call, convert_for_arg_passing (or earlier code) should change those arguments to reference passing. On this testcase the call is generated from simplify_aggr_init_expr, and is passed by value instead. I don't know the FE enough to know if it should be already aggr_init_expr AGGR_INIT_EXPR_ARGP argument to be actually the reference, or if it is a simplify_aggr_init_expr bug. Jason, can you please have a look?
(In reply to Jakub Jelinek from comment #1) > Started with r232168. I don't think so; reverting that commit doesn't change anything.
Not r232168 but r232167 it seems.
Author: jason Date: Fri Feb 26 04:53:58 2016 New Revision: 233733 URL: https://gcc.gnu.org/viewcvs?rev=233733&root=gcc&view=rev Log: PR c++/69889 * cp-tree.h (AGGR_INIT_FROM_THUNK_P): New. * tree.c (build_aggr_init_expr): Set it. * semantics.c (simplify_aggr_init_expr): Check it. * cp-gimplify.c (cp_genericize_r): Don't walk into a call/aggr_init from a thunk. Added: trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv10.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/cp-gimplify.c trunk/gcc/cp/cp-tree.h trunk/gcc/cp/semantics.c trunk/gcc/cp/tree.c
Fixed.
Thanks for taking care of this so quickly. I currently do not observe any more ICEs from that codebase.