Commit 447cf554 by Jason Merrill Committed by Jason Merrill

re PR c++/57408 (lambda, Variable length arrays, thread, internal compiler…

re PR c++/57408 (lambda, Variable length arrays, thread, internal compiler error: in expand_expr_real_1, at expr.c:9327)

	PR c++/57408
	* semantics.c (add_capture): Set type to error_mark_node after
	error.

From-SVN: r200449
parent 412ec6cf
2013-06-21 Jason Merrill <jason@redhat.com>
PR c++/57408
* semantics.c (add_capture): Set type to error_mark_node after
error.
2013-06-25 Ed Smith-Rowland <3dw4rd@verizon.net> 2013-06-25 Ed Smith-Rowland <3dw4rd@verizon.net>
PR c++/57640 PR c++/57640
......
...@@ -9521,6 +9521,7 @@ add_capture (tree lambda, tree id, tree initializer, bool by_reference_p, ...@@ -9521,6 +9521,7 @@ add_capture (tree lambda, tree id, tree initializer, bool by_reference_p,
&& variably_modified_type_p (TREE_TYPE (type), NULL_TREE)) && variably_modified_type_p (TREE_TYPE (type), NULL_TREE))
inform (input_location, "because the array element type %qT has " inform (input_location, "because the array element type %qT has "
"variable size", TREE_TYPE (type)); "variable size", TREE_TYPE (type));
type = error_mark_node;
} }
else if (by_reference_p) else if (by_reference_p)
{ {
......
// PR c++/57408
// { dg-options "-std=c++1y -pedantic-errors" }
template<typename Callable>
struct Impl
{
Callable func;
Impl(Callable f) : func(f) { }
virtual void run() { func(); }
};
template<typename Callable>
void call(Callable f)
{
Impl<Callable>(f).run();
}
extern "C" int printf(const char*, ...);
int main(){
int y = 2;
float fa[2][y]; // { dg-error "array of array of runtime bound" }
fa[0][0]=0.8;
fa[0][1]=1.8;
auto fx=[&](){
for(int c=0; c<2; c++){
printf("use me", fa[0][c]); // { dg-error "capture of variable-size type" }
}
};
call(fx);
}
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