Commit c138ee6d by Paolo Carlini Committed by Paolo Carlini

re PR c++/51227 ([c++0x] ICE with invalid parameter in lambda expression)

/cp
2011-11-24  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51227
	* pt.c (instantiate_class_template_1): If lambda_function (type)
	is NULL_TREE do not instantiate_decl.

/testsuite
2011-11-24  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51227
	* g++.dg/cpp0x/lambda/lambda-ice5.C: New.

From-SVN: r181707
parent 28a4bba2
2011-11-24 Paolo Carlini <paolo.carlini@oracle.com> 2011-11-24 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51227
* pt.c (instantiate_class_template_1): If lambda_function (type)
is NULL_TREE do not instantiate_decl.
2011-11-24 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51290 PR c++/51290
* class.c (build_base_path): For the null pointer check use * class.c (build_base_path): For the null pointer check use
nullptr_node instead of integer_zero_node. nullptr_node instead of integer_zero_node.
......
...@@ -9103,14 +9103,20 @@ instantiate_class_template_1 (tree type) ...@@ -9103,14 +9103,20 @@ instantiate_class_template_1 (tree type)
if (CLASSTYPE_LAMBDA_EXPR (type)) if (CLASSTYPE_LAMBDA_EXPR (type))
{ {
tree lambda = CLASSTYPE_LAMBDA_EXPR (type); tree decl = lambda_function (type);
if (LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P (lambda)) if (decl)
{ {
apply_lambda_return_type (lambda, void_type_node); tree lambda = CLASSTYPE_LAMBDA_EXPR (type);
LAMBDA_EXPR_RETURN_TYPE (lambda) = NULL_TREE; if (LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P (lambda))
{
apply_lambda_return_type (lambda, void_type_node);
LAMBDA_EXPR_RETURN_TYPE (lambda) = NULL_TREE;
}
instantiate_decl (decl, false, false);
maybe_add_lambda_conv_op (type);
} }
instantiate_decl (lambda_function (type), false, false); else
maybe_add_lambda_conv_op (type); gcc_assert (errorcount);
} }
/* Set the file and line number information to whatever is given for /* Set the file and line number information to whatever is given for
......
2011-11-24 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51227
* g++.dg/cpp0x/lambda/lambda-ice5.C: New.
2011-11-24 H.J. Lu <hongjiu.lu@intel.com> 2011-11-24 H.J. Lu <hongjiu.lu@intel.com>
PR target/51134 PR target/51134
......
// PR c++/51227
// { dg-options "-std=c++0x" }
template<int> int foo()
{
[] (void i) { return 0; } (0); // { dg-error "incomplete|invalid|no match" }
}
void bar()
{
foo<0>();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment