* [PATCH] c++: Remove GCC12 FIXME for DR1312
@ 2021-04-29 1:53 Marek Polacek
2021-05-03 16:23 ` Jason Merrill
0 siblings, 1 reply; 2+ messages in thread
From: Marek Polacek @ 2021-04-29 1:53 UTC (permalink / raw)
To: Jason Merrill, GCC Patches
This patch removes a FIXME I left for myself for GCC 12, along with
adjusting the relevant test.
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?
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.
---
gcc/cp/constexpr.c | 3 +--
gcc/testsuite/g++.dg/cpp0x/constexpr-cast2.C | 6 +++---
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index fa7eaed945a..64112ff88c5 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -6747,8 +6747,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 7c37f6a3f5a..b79e8a90131 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" }
base-commit: e4aefface2a0e34d84b85844b11652eb28f2cf0c
--
2.31.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] c++: Remove GCC12 FIXME for DR1312
2021-04-29 1:53 [PATCH] c++: Remove GCC12 FIXME for DR1312 Marek Polacek
@ 2021-05-03 16:23 ` Jason Merrill
0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2021-05-03 16:23 UTC (permalink / raw)
To: Marek Polacek, GCC Patches
On 4/28/21 9:53 PM, Marek Polacek wrote:
> This patch removes a FIXME I left for myself for GCC 12, along with
> adjusting the relevant test.
>
> Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?
OK.
> 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.
> ---
> gcc/cp/constexpr.c | 3 +--
> gcc/testsuite/g++.dg/cpp0x/constexpr-cast2.C | 6 +++---
> 2 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
> index fa7eaed945a..64112ff88c5 100644
> --- a/gcc/cp/constexpr.c
> +++ b/gcc/cp/constexpr.c
> @@ -6747,8 +6747,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 7c37f6a3f5a..b79e8a90131 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" }
>
> base-commit: e4aefface2a0e34d84b85844b11652eb28f2cf0c
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-03 16:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29 1:53 [PATCH] c++: Remove GCC12 FIXME for DR1312 Marek Polacek
2021-05-03 16:23 ` Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).