PR c++/58597
* lambda.c (maybe_add_lambda_conv_op): Check cfun rather than
current_function_decl.
From-SVN: r220192
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.
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);
--- /dev/null
+// 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;