Created attachment 40032 [details] c++ code The following code generates a "internal compiler error: Segmentation fault". Code and gcc trace attached. If I specify that `f` is `constexpr`, then there is not a segmentation fault. This code began as an attempt to identify at compile time if a given expression can be treated as a constant expression, but here I have simplified it. (The full code worked in clang in the manner that I expected. See http://stackoverflow.com/a/40413051/146041 for more on the context.) My hunch is that 'f' is the problem here. It is being used in the computation of the return type of the generic lambda. In this particular codebase, I would expect a conventional refusal to compile with an error message about the fact that a constant expression is necessary as the non-type int parameter to the template Void. // g++ (GCC) 6.2.0 struct X { static constexpr int foo (int b) { return b; } }; template<int> using Void = void; template<typename F,typename A> auto bar(F f, A a) -> decltype( ( f(a) , 0 ) ) { return {}; } int main() { //constexpr int f = 3; (void)f; auto l = [](auto of_type_X)-> Void<(decltype(of_type_X):: foo(f) ,0)>{return;}; bar( l , X{}); }
Created attachment 40033 [details] crashing output from gcc 6.2.0
ICEs since r210017, before it has been rejected.
Author: jason Date: Wed Jan 11 21:43:42 2017 New Revision: 244340 URL: https://gcc.gnu.org/viewcvs?rev=244340&root=gcc&view=rev Log: PR c++/78337 - ICE on invalid with generic lambda * semantics.c (process_outer_var_ref): Check if containing_function is null. Move inform call under complain test. Added: trunk/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice5.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/semantics.c
Fixed for 7+.