Re: Change copyObject() to use typeof_unqual

Jelte Fennema <postgres@jeltef.nl>

From: "Jelte Fennema-Nio" <postgres@jeltef.nl>
To: "Tom Lane" <tgl@sss.pgh.pa.us>, "Masahiko Sawada" <sawada.mshk@gmail.com>
Cc: "Peter Eisentraut" <peter@eisentraut.org>, "pgsql-hackers" <pgsql-hackers@postgresql.org>
Date: 2026-03-17T10:56:24Z
Lists: pgsql-hackers

Attachments

On Tue Mar 17, 2026 at 3:39 AM CET, Tom Lane wrote:
> While this version of clang doesn't like typeof_unqual, it does take
> __typeof_unqual__.  So maybe we were premature to decide that we
> could prefer the typeof_unqual spelling.

Hmmm, that makes sense. How about this patch to at least keep the
all the logic related to this in one place? I was able to reproduce this
error using the following flags, and this fixes the issue for me.

CC=clang-21 CXX=clang++-21 CFLAGS=-std=c23 BITCODE_CFLAGS=-std=gnu17 CLANG=clang-19 LLVM_CONFIG=llvm-config-19

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add some const qualifiers enabled by typeof_unqual change on copyObject

  2. Hardcode typeof_unqual to __typeof_unqual__ for clang

  3. Clean up postgres_fdw/t/010_subscription.pl.

  4. Hardcode override of typeof_unqual for clang-for-bitcode

  5. Make typeof and typeof_unqual fallback definitions work on C++11

  6. Change copyObject() to use typeof_unqual

  7. Fixes for C++ typeof implementation

  8. Support using copyObject in standard C++