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:
parent
ba1e69c03f
commit
dc8d2d00c5
@ -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
|
||||
|
@ -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:
|
||||
|
5
gcc/testsuite/g++.dg/cpp0x/constexpr-complex2.C
Normal file
5
gcc/testsuite/g++.dg/cpp0x/constexpr-complex2.C
Normal file
@ -0,0 +1,5 @@
|
||||
// { dg-do compile { target c++11 } }
|
||||
// { dg-options "" }
|
||||
|
||||
static _Complex int i;
|
||||
static_assert (&__imag i == &__imag i, "");
|
Loading…
Reference in New Issue
Block a user