PR c++/61402
* lambda.c (add_capture): Don't pass a dependent type to
variably_modified_type_p.
From-SVN: r218680
+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>
Remove N3639 "array of runtime length" from -std=c++14.
NULL_TREE, array_type_nelts (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 "
"of runtime bound", type);
--- /dev/null
+// 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);
+}