Fix constexpr lvalue use of __real and __imag.

* constexpr.c (potential_constant_expression_1): REALPART_EXPR and
	IMAGPART_EXPR can be lvalues.

From-SVN: r242349
This commit is contained in:
Jason Merrill 2016-11-13 01:52:15 -05:00 committed by Jason Merrill
parent ba1e69c03f
commit dc8d2d00c5
3 changed files with 10 additions and 2 deletions

View File

@ -1,5 +1,8 @@
2016-11-12 Jason Merrill <jason@redhat.com>
* constexpr.c (potential_constant_expression_1): REALPART_EXPR and
IMAGPART_EXPR can be lvalues.
DR 374
PR c++/56840
* pt.c (check_specialization_namespace): Allow any enclosing

View File

@ -5105,6 +5105,8 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict,
#endif
return RECUR (t, any);
case REALPART_EXPR:
case IMAGPART_EXPR:
case COMPONENT_REF:
case BIT_FIELD_REF:
case ARROW_EXPR:
@ -5276,8 +5278,6 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict,
return true;
/* fall through. */
case REALPART_EXPR:
case IMAGPART_EXPR:
case CONJ_EXPR:
case SAVE_EXPR:
case FIX_TRUNC_EXPR:

View File

@ -0,0 +1,5 @@
// { dg-do compile { target c++11 } }
// { dg-options "" }
static _Complex int i;
static_assert (&__imag i == &__imag i, "");