+2014-09-22 Jason Merrill <jason@redhat.com>
+
+ PR c++/63320
+ PR c++/60463
+ PR c++/60755
+ * lambda.c (maybe_resolve_dummy, lambda_expr_this_capture): Handle
+ not finding 'this'.
+
2014-09-22 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/62219
if (!this_capture)
{
- error ("%<this%> was not captured for this lambda function");
+ if (add_capture_p)
+ error ("%<this%> was not captured for this lambda function");
result = error_mark_node;
}
else
/* In a lambda, need to go through 'this' capture. */
tree lam = CLASSTYPE_LAMBDA_EXPR (current_class_type);
tree cap = lambda_expr_this_capture (lam, add_capture_p);
- object = build_x_indirect_ref (EXPR_LOCATION (object), cap,
- RO_NULL, tf_warning_or_error);
+ if (cap != error_mark_node)
+ object = build_x_indirect_ref (EXPR_LOCATION (object), cap,
+ RO_NULL, tf_warning_or_error);
}
return object;
class Klass
{
- unsigned int local;
+ unsigned int local; // { dg-error "non-static" }
public:
bool dostuff();
};
bool Klass::dostuff()
{
auto f = []() -> bool {
- if (local & 1) { return true; } // { dg-error "not captured" }
+ if (local & 1) { return true; } // { dg-error "not captured|this location" }
return false;
};
}
--- /dev/null
+// PR c++/63320
+// { dg-do compile { target c++11 } }
+
+class A {
+ static void addWindow();
+ static void activateWindow(void *);
+};
+void A::addWindow() {
+ int* action {};
+ [action] { activateWindow(action); };
+}