Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vVUBL-004Lwz-14 for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Dec 2025 12:29:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vVUAK-006Nl4-1p for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Dec 2025 12:28:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vVUAK-006Nkv-0r for pgsql-hackers@lists.postgresql.org; Tue, 16 Dec 2025 12:28:33 +0000 Received: from fhigh-b5-smtp.messagingengine.com ([202.12.124.156]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vVUAI-000xlT-2s for pgsql-hackers@lists.postgresql.org; Tue, 16 Dec 2025 12:28:32 +0000 Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfhigh.stl.internal (Postfix) with ESMTP id 671B87A0193; Tue, 16 Dec 2025 07:28:29 -0500 (EST) Received: from phl-frontend-02 ([10.202.2.161]) by phl-compute-03.internal (MEProxy); Tue, 16 Dec 2025 07:28:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1765888109; x=1765974509; bh=MtPhflBIKU9/r2ssuDLX8KOShHHhjD/IRcdFc/ofEWg=; b= rxNzTnkfhZ7+OfYTcdohVadIi5RdyvdwXmADHSmIBsTC+HRGUOwZyryarREKB/7D 3vY8KCXC1vXp1YsfMwEeCUfQSi8p2iv4P5/42wIxY+HQb+uupMrQ305JTYiG2dwH PQjVDG/JtD4eftPD9xMB1Rzf/oEWzkDMubMB8O4qw6MYCycAB+kDc7gLfYjiMFKE kNZ4Zq10oyFEpRdJr2TMsAp1ap8wonM1rwzV9AIEkjL+/ZwoDnexdMjse3Ac3mjQ 48okIN4eQ+uvjZ4G93tosyBKPJbHAGQmFCTqyfcWtaTCG/FRtdRI+iu3OLuDTHuO Jx58sAdqU6Io+8LajEiMSA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1765888109; x=1765974509; bh=M tPhflBIKU9/r2ssuDLX8KOShHHhjD/IRcdFc/ofEWg=; b=ZFXtKBouLrX9uYVy8 rmuPhSUTm7ztAO1/KWq+jPaQ3NtAaaqvaB1ponvOhxsYJM/DDm3KnQYgxYYdUHXe cr/4jGb3pGPYVBG9uifD4BgyBiWqTIIIgwMutANuGlRGo8OCyhC9GGRPyiWDfNds EdakluRQ4LnsRIAxWRAT1cPRkFcGVAhVL4cmFhnmsGyFBsFRJAzbLJKNz2QFJszY 3LtmShdgYnfan2oF357CZxi3W3f+aTMij36uXk20WIIcmrJQO98n7CHRBynAI69d cmZmIYI9n3CJ04aOu8x+tgjSN1MMrrjw6feP43tSDaBSILXRowKfUKk83CVGc+do yaZlw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdefleeikecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefkffggfgfuvfhfhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpefrvghtvghrucfg ihhsvghnthhrrghuthcuoehpvghtvghrsegvihhsvghnthhrrghuthdrohhrgheqnecugg ftrfgrthhtvghrnhepgeeuuedvhfehueeijeetgfdutdfhveevfeeugfdtvdfgteetheej teeluedvvedunecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrghenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrsegvihhs vghnthhrrghuthdrohhrghdpnhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouh htpdhrtghpthhtohepphhoshhtghhrvghssehjvghlthgvfhdrnhhlpdhrtghpthhtohep phhgshhqlhdqhhgrtghkvghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhgpd hrtghpthhtohepthhhohhmrghsrdhmuhhnrhhosehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 16 Dec 2025 07:28:28 -0500 (EST) Message-ID: <4d8b9e53-3f37-43f0-a4aa-5bda9c7961b3@eisentraut.org> Date: Tue, 16 Dec 2025 13:28:27 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Make copyObject work in C++ To: Jelte Fennema-Nio , PostgreSQL Hackers , Thomas Munro References: Content-Language: en-US From: Peter Eisentraut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 05.12.25 15:46, Jelte Fennema-Nio wrote: > 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. I think it might be good to create a test extension written in C++, like under src/test/modules/, and sprinkle it with various constructs like copyObject() and static assertions, and whatever else we find that is possibly problematic. Then patches like this one would be much easier to analyze and test and keep working in the future. This would probably require resolving first.