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.
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
