public inbox for [email protected]
help / color / mirror / Atom feedFrom: Jelte Fennema-Nio <[email protected]>
To: Peter Eisentraut <[email protected]>
Cc: Daniel Gustafsson <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Change copyObject() to use typeof_unqual
Date: Sat, 14 Mar 2026 14:41:08 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
<CAGECzQSxqAgF4YA_2C3mBKoTJ1-Mc3uVMAe2AgLjibnv4Ltkuw@mail.gmail.com>
<[email protected]>
<[email protected]>
<[email protected]>
<CAGECzQR-t-Zq6p3KAkohfWcOMGoaqNUqAGj9WC3PxA_zynqEVw@mail.gmail.com>
<CAGECzQSzXop4L4=y297r8cCjfwLv8mwUi1pxN3ufevbeXSVLNA@mail.gmail.com>
<[email protected]>
On Sat, 14 Mar 2026 at 14:03, Peter Eisentraut <[email protected]> wrote:
> This doesn't appear to work in this example program:
Ugh, I should not send emails end of day on a friday in a rush.
Attached is fixed v3 which uses ::type instead.
I was able to reproduce the compilation errors on my machine by using
CXXFLAGS='-std=c++11' when configuring meson, and this patch fixes them.
I think it would be good if we would run one of our CI jobs in c11 and
c++11 (non-gnu) mode so we catch these kind of issues before hitting the
build farm.
Attachments:
[text/x-patch] v3-0001-Make-typeof-and-typeof_unqual-fallback-definition.patch (1.3K, ../[email protected]/2-v3-0001-Make-typeof-and-typeof_unqual-fallback-definition.patch)
download | inline diff:
From d7acf4680fcfa81d0b046241ee5e36fd47f46b06 Mon Sep 17 00:00:00 2001
From: Jelte Fennema-Nio <[email protected]>
Date: Sat, 14 Mar 2026 14:33:07 +0100
Subject: [PATCH v3] Make typeof and typeof_unqual fallback definitions work on
C++11
These macros were unintentionally using C++14 features. This replaces
them with valid C++11 code.
Tested locally by compiling with -std=c++11 (which reproduced the
original issue).
---
src/include/c.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/include/c.h b/src/include/c.h
index 2aab74d8b0e..29fef2f54e1 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -447,7 +447,7 @@ extern "C++"
#ifdef pg_cxx_typeof
#define typeof(x) pg_cxx_typeof(x)
#elif !defined(HAVE_CXX_TYPEOF)
-#define typeof(x) std::remove_reference_t<decltype(x)>
+#define typeof(x) std::remove_reference<decltype(x)>::type
#endif
#ifndef HAVE_TYPEOF
#define HAVE_TYPEOF 1
@@ -459,7 +459,7 @@ extern "C++"
#ifdef pg_cxx_typeof_unqual
#define typeof_unqual(x) pg_cxx_typeof_unqual(x)
#elif !defined(HAVE_CXX_TYPEOF_UNQUAL)
-#define typeof_unqual(x) std::remove_cv_t<std::remove_reference_t<decltype(x)>>
+#define typeof_unqual(x) std::remove_cv<std::remove_reference<decltype(x)>::type>::type
#endif
#ifndef HAVE_TYPEOF_UNQUAL
#define HAVE_TYPEOF_UNQUAL 1
base-commit: ae58189a4d523f0156ebe30f4534180555669e88
--
2.53.0
view thread (23+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Change copyObject() to use typeof_unqual
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox