Make copyObject work in C++
Jelte Fennema-Nio <postgres@jeltef.nl>
From: Jelte Fennema-Nio <postgres@jeltef.nl>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Thomas Munro <thomas.munro@gmail.com>
Date: 2025-12-05T14:46:57Z
Lists: pgsql-hackers
Attachments
- v1-0001-Make-copyObject-work-in-C.patch (application/x-patch)
Calling copyObject fails in C++ with an error like in most setups: error: use of undeclared identifier 'typeof'; did you mean 'typeid' This is due to the C compiler supporting used to compile postgres supporting typeof, but that function actually not being present in the C++ compiler. This fixes that by using decltype instead of typeof when including the header in C++. Realized because of Thomas' not about how much of our headers should work in C++, and remembering I hit this specific problem myself. Another approach would be to force the value of HAVE_TYPEOF to 0 if __cplusplus.