+2017-06-09 Jason Merrill <jason@redhat.com>
+
+ * constexpr.c (potential_constant_expression_1): Allow 'this' capture.
+
2017-06-09 Jan Hubicka <hubicka@ucw.cz>
* class.c (build_vtbl_initializer): Mark dvirt_fn as cold.
{
tree x = TREE_OPERAND (t, 0);
STRIP_NOPS (x);
- if (is_this_parameter (x))
+ if (is_this_parameter (x) && !is_capture_proxy (x))
{
if (DECL_CONTEXT (x)
&& !DECL_DECLARED_CONSTEXPR_P (DECL_CONTEXT (x)))
--- /dev/null
+// { dg-options -std=c++1z }
+
+struct S {
+ int i;
+ constexpr S() : i(5) {
+ ([*this] () { return i + 10; }());
+ }
+ constexpr operator int() const { return i; }
+};
+constexpr int x = S();