aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2021-04-28 19:11:14 -0400
committerMarek Polacek <polacek@redhat.com>2021-05-03 12:27:30 -0400
commit6252e35cf5cea9a30a57ceffbc7a9f3160900a45 (patch)
tree982cd8da2dcd4128ef2cf78dac60bd52b6bf0126 /gcc
parent0871fe27c24481d3ab5e9b4f40ac2e6629e2dc99 (diff)
downloadgcc-6252e35cf5cea9a30a57ceffbc7a9f3160900a45.zip
gcc-6252e35cf5cea9a30a57ceffbc7a9f3160900a45.tar.gz
gcc-6252e35cf5cea9a30a57ceffbc7a9f3160900a45.tar.bz2
c++: Remove GCC12 FIXME for DR1312
This patch removes a FIXME I left for myself for GCC 12, along with adjusting the relevant test. gcc/cp/ChangeLog: DR 1312 * constexpr.c (cxx_eval_constant_expression): Don't check integer_zerop. gcc/testsuite/ChangeLog: DR 1312 * g++.dg/cpp0x/constexpr-cast2.C: Remove XFAILs.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/constexpr.c3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-cast2.C6
2 files changed, 4 insertions, 5 deletions
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 9481a5b..9cb761d 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -6745,8 +6745,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
/* [expr.const]: a conversion from type cv void* to a pointer-to-object
type cannot be part of a core constant expression as a resolution to
DR 1312. */
- if (integer_zerop (op) /* FIXME: Remove in GCC 12. */
- && TYPE_PTROB_P (type)
+ if (TYPE_PTROB_P (type)
&& TYPE_PTR_P (TREE_TYPE (op))
&& VOID_TYPE_P (TREE_TYPE (TREE_TYPE (op)))
/* Inside a call to std::construct_at or to
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-cast2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-cast2.C
index 7c37f6a..b79e8a9 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-cast2.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-cast2.C
@@ -6,11 +6,11 @@ static int i;
constexpr void *vp0 = nullptr;
constexpr void *vpi = &i;
constexpr int *p1 = (int *) vp0; // { dg-error "cast from .void\\*. is not allowed" }
-constexpr int *p2 = (int *) vpi; // { dg-error "cast from .void\\*. is not allowed" "integer_zerop" { xfail *-*-* } }
+constexpr int *p2 = (int *) vpi; // { dg-error "cast from .void\\*. is not allowed" }
constexpr int *p3 = static_cast<int *>(vp0); // { dg-error "cast from .void\\*. is not allowed" }
-constexpr int *p4 = static_cast<int *>(vpi); // { dg-error "cast from .void\\*. is not allowed" "integer_zerop" { xfail *-*-* } }
+constexpr int *p4 = static_cast<int *>(vpi); // { dg-error "cast from .void\\*. is not allowed" }
constexpr void *p5 = vp0;
constexpr void *p6 = vpi;
constexpr int *pi = &i;
-constexpr bool b = ((int *)(void *) pi == pi); // { dg-error "cast from .void\\*. is not allowed" "integer_zerop" { xfail *-*-* } }
+constexpr bool b = ((int *)(void *) pi == pi); // { dg-error "cast from .void\\*. is not allowed" }