re PR c++/58597 (ICE with lambda in default argument of template function)

PR c++/58597
	* lambda.c (maybe_add_lambda_conv_op): Check cfun rather than
	current_function_decl.

From-SVN: r220192
This commit is contained in:
Jason Merrill 2015-01-27 16:40:45 -05:00 committed by Jason Merrill
parent 53c04ec92a
commit 2cc7f90b6e
3 changed files with 14 additions and 1 deletions

View File

@ -1,5 +1,9 @@
2015-01-27 Jason Merrill <jason@redhat.com>
PR c++/58597
* lambda.c (maybe_add_lambda_conv_op): Check cfun rather than
current_function_decl.
PR c++/63889
* pt.c (finish_template_variable): Move from semantics.c.
Handle multiple template arg levels. Handle coercion here.

View File

@ -854,7 +854,7 @@ prepare_op_call (tree fn, int nargs)
void
maybe_add_lambda_conv_op (tree type)
{
bool nested = (current_function_decl != NULL_TREE);
bool nested = (cfun != NULL);
bool nested_def = decl_function_context (TYPE_MAIN_DECL (type));
tree callop = lambda_function (type);

View File

@ -0,0 +1,9 @@
// PR c++/58597
// { dg-do compile { target c++11 } }
template<typename> struct A
{
template<typename T> A(T, int = []{ return 0; }()) {}
};
A<int> a = 0;