Commit 18e780d4 by Jason Merrill Committed by Jason Merrill

re PR c++/61402 (-Wsequence-point doesn't notice unsequenced lambda init and function argument)

	PR c++/61402
	* lambda.c (add_capture): Don't pass a dependent type to
	variably_modified_type_p.

From-SVN: r218680
parent 0f3d27f0
2014-12-12 Jason Merrill <jason@redhat.com>
PR c++/61402
* lambda.c (add_capture): Don't pass a dependent type to
variably_modified_type_p.
2014-12-11 Jason Merrill <jason@redhat.com> 2014-12-11 Jason Merrill <jason@redhat.com>
Remove N3639 "array of runtime length" from -std=c++14. Remove N3639 "array of runtime length" from -std=c++14.
......
...@@ -483,7 +483,8 @@ add_capture (tree lambda, tree id, tree orig_init, bool by_reference_p, ...@@ -483,7 +483,8 @@ add_capture (tree lambda, tree id, tree orig_init, bool by_reference_p,
NULL_TREE, array_type_nelts (type)); NULL_TREE, array_type_nelts (type));
type = vla_capture_type (type); type = vla_capture_type (type);
} }
else if (variably_modified_type_p (type, NULL_TREE)) else if (!dependent_type_p (type)
&& variably_modified_type_p (type, NULL_TREE))
{ {
error ("capture of variable-size type %qT that is not an N3639 array " error ("capture of variable-size type %qT that is not an N3639 array "
"of runtime bound", type); "of runtime bound", type);
......
// PR c++/61402
// { dg-do run { target c++14 } }
extern "C" void abort();
template<typename T>
void foo(T t) {
auto test = [ i = ++t ](T v) {
if (i != v)
abort();
};
test(t);
}
int main(){
foo(3.14f);
foo(0);
foo('a');
foo(false);
}
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