mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-31 09:20:44 +08:00
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
This commit is contained in:
parent
28a4bba202
commit
c138ee6de2
@ -1,3 +1,9 @@
|
||||
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
|
||||
|
18
gcc/cp/pt.c
18
gcc/cp/pt.c
@ -9103,14 +9103,20 @@ instantiate_class_template_1 (tree type)
|
||||
|
||||
if (CLASSTYPE_LAMBDA_EXPR (type))
|
||||
{
|
||||
tree lambda = CLASSTYPE_LAMBDA_EXPR (type);
|
||||
if (LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P (lambda))
|
||||
tree decl = lambda_function (type);
|
||||
if (decl)
|
||||
{
|
||||
apply_lambda_return_type (lambda, void_type_node);
|
||||
LAMBDA_EXPR_RETURN_TYPE (lambda) = NULL_TREE;
|
||||
tree lambda = CLASSTYPE_LAMBDA_EXPR (type);
|
||||
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);
|
||||
maybe_add_lambda_conv_op (type);
|
||||
else
|
||||
gcc_assert (errorcount);
|
||||
}
|
||||
|
||||
/* Set the file and line number information to whatever is given for
|
||||
|
@ -1,3 +1,8 @@
|
||||
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>
|
||||
|
||||
PR target/51134
|
||||
|
12
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice5.C
Normal file
12
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice5.C
Normal file
@ -0,0 +1,12 @@
|
||||
// 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>();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user