]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Make typeof and typeof_unqual fallback definitions work on C++11
authorPeter Eisentraut <peter@eisentraut.org>
Sun, 15 Mar 2026 06:36:27 +0000 (07:36 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Sun, 15 Mar 2026 06:36:27 +0000 (07:36 +0100)
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).

Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Discussion: https://www.postgresql.org/message-id/flat/92f9750f-c7f6-42d8-9a4a-85a3cbe808f3%40eisentraut.org

src/include/c.h

index 2aab74d8b0ec8114efced89d1397e7178922a248..29fef2f54e1eb5c8492bb35002ea5734a0b8b224 100644 (file)
@@ -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