Re: Make copyObject work in C++
Bryan Green <dbryan.green@gmail.com>
From: Bryan Green <dbryan.green@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Date: 2026-02-04T15:54:37Z
Lists: pgsql-hackers
On 1/25/2026 6:42 AM, Jelte Fennema-Nio wrote: > On Tue Jan 20, 2026 at 5:28 PM CET, Peter Eisentraut wrote: >> I have split your first patch further. For a start, I left out the >> PG_MODULE_MAGIC*-related changes and disabled the module under MSVC. >> This has been committed. I plan to let the buildfarm run with it for >> a day or two and then add in the basic MSVC support. > > To hopefully make your life a bit easier. Here's a rebased version that > enables the MSVC support again, with an updated commit message. > This causes the build to break on VS 2022. Versions prior do not have support for __typeof_unqual__. This would have led to HAVE_TYPEOF_UNQUAL being not defined on the buildfarm causing the fallback to copyObjectImpl() for VS 2019. When you build on VS 2022 you will get an error: ../src/backend/commands/event_trigger.c(1901): error C2100: you cannot dereference an operand of type 'void' VS 2022 (MSVC) does not handle the void * dereference the way gcc/clang does (thanks to GNU extensions, I believe). It exposes __typeof_unqual__ even it C11, but enforces strict C semantics on the void * dereference. To work on this platform the call copyObject(lfirst(cell)) would need to have a cast to the correct concrete type: copyObject((Node *)lfirst(cell)). I was about to update to VS 2026, but now I think I should have an instance of VS from 2019, 2022, and 2026. -- Bryan Green EDB: https://www.enterprisedb.com
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Enable test_cplusplusext with MSVC
- c05ad248f99c 19 (unreleased) landed
-
Disable some C++ warnings in MSVC
- 82a7cbea747c 19 (unreleased) landed
-
meson: Make room for C++-only warning flags for MSVC
- 4c83f1253593 19 (unreleased) landed
-
Make fixed-length list building macros work in C++
- f8e7ca328510 19 (unreleased) landed
-
Make unconstify and unvolatize use StaticAssertVariableIsOfTypeMacro
- 258248d0bdbf 19 (unreleased) landed
-
Use typeof everywhere instead of compiler specific spellings
- e2308350c9b7 19 (unreleased) landed
-
Test List macros in C++ extensions
- 3d28ecb5ac76 19 (unreleased) landed
-
Test most StaticAssert macros in C++ extensions
- 451650eaacd5 19 (unreleased) landed
-
Revert "Change copyObject() to use typeof_unqual"
- 0af05b5dbb42 19 (unreleased) landed
-
Fix for C++ compatibility
- b4555cb070f1 19 (unreleased) landed
-
tests: Add a test C++ extension module
- 476b35d4e311 19 (unreleased) landed