Commit 948d0d91 by Jason Merrill Committed by Jason Merrill

* constexpr.c (potential_constant_expression_1): Allow 'this' capture.

From-SVN: r249077
parent a1f427e9
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.
......
......@@ -5296,7 +5296,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict,
{
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)))
......
// { 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();
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