From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id v2XfFdAaxmkDQjsAWB0awg (envelope-from ) for ; Fri, 27 Mar 2026 01:51:12 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=gnu.org header.i=@gnu.org header.a=rsa-sha256 header.s=fencepost-gnu-org header.b=XoT0mdKz; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 474E01E0BC; Fri, 27 Mar 2026 01:51:12 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 728261E04F for ; Fri, 27 Mar 2026 01:51:11 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 7C43F4B9DB79 for ; Fri, 27 Mar 2026 05:51:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7C43F4B9DB79 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gnu.org header.i=@gnu.org header.a=rsa-sha256 header.s=fencepost-gnu-org header.b=XoT0mdKz Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 5063D4BA9038 for ; Fri, 27 Mar 2026 05:50:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5063D4BA9038 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5063D4BA9038 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:142:3::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774590646; cv=none; b=mJwxSGKr4XSObdeKhCD/m4ANCoHDYavSOLsmMjGkCCoqVHP+XnGqkqOnbkXOvxuiyxmd5vEBkbGt97R1xKbuxfPkE1RXTU4LAwI7J7AIrPrfT/V2uaNZDMUyq8Mt/ucr3qJLfkPGVG+whEdHIg3+7MB4jOIgOpZBlcWRuuzVc18= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774590646; c=relaxed/simple; bh=cQxMH8Ybo+llKzatsmBsVprMFhuldEKS1VI3v8WMkUU=; h=DKIM-Signature:Date:Message-Id:From:To:Subject:MIME-version; b=jrkqq4guwxaxLatdoku+8VNlo8299E9b28nq0ml4CHQbHlFv7umfCxSU+rWUtgkmuoKtSO76sdtZHVmfUSwv8ptZBjrSvtjl6EW1oxb1e9Vv1BKlUuF+5fi9rINAJAsWtdGrZqL4udz70cjkC8MzIDh1fZtrK/knkGlTBnQF5CE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5063D4BA9038 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w605j-00012e-VX; Fri, 27 Mar 2026 01:50:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=1mM614c6kjZhuQRnKUgMFvEvSfrvQoOIntWsPzHHZjE=; b=XoT0mdKzusejibM2WZYq zBmxAUy0G66nAXsRD6yr2Zoe0EQSDwSZ+bEZMZEjZJfIPaS5YN2SUmJKcJ1tGxYUminqxc7NeBfpc 9v2aQ7GNmZH/aM2WzEuS1HIW+inBjyWSelGqj6rS/cW7oUwbjVwg9AHCZDd23KgmL/l4oXy7Mmwki 5Tt3p8twKwsr/WnbLeNCE6SGWbuzNW6csESVZfbyPbP639eg1GxLIuO54DTYQVLV+/VfojP3kfzrI TcQnOwzfEOUUQpw1h6v8zMdA2F2+1S6F1YKB2jpZcKMWeeg3fNz6PqiCYR5Hlt6odbshAuypGxbnM gYhj/1Xr0Fh3fg==; Date: Fri, 27 Mar 2026 08:50:38 +0300 Message-Id: <86tsu1vn0x.fsf@gnu.org> From: Eli Zaretskii To: Keith Seitz Cc: gdb-patches@sourceware.org In-Reply-To: (message from Keith Seitz on Thu, 26 Mar 2026 12:17:20 -0700) Subject: Re: [PATCH] Add infcall support for C++ constructor-style expressions References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org > From: Keith Seitz > Date: Thu, 26 Mar 2026 12:17:20 -0700 > > This patch adds an initial try at teaching the expression parser/evaluator > to construct temporary objects requiring construction during an inferior > function call. > > To accomplish this, I've chosen the route of modifying the parser to > teach it that `Type(args)' is a function call when `Type' names a > class/struct/union and is immediately followed by '(', that is, via look- > ahead). A new parser token and grammar rule have been added to deal > with this new production. > > The real work is dispatched to `type_operation::evaluate_funcall', > allocating memory for the temporary and finding the most suitable constructor > with `find_overload_match'. It then runs the inferior call, returning > the newly constructed object. > > I've included many tests covering as many corner cases as I could invent, > and these tests are clang clean. They also introduce no regressions on > x86-64 Fedora 43 with GCC 15.2.1 and RHEL 9.4 with GCC 11.5.0. > > Example: > Consider a C++ frame where 'struct S { int x; S(int); ... }' is in scope > > Before: > (gdb) print S(42) > ❌️ A syntax error in expression, near `10)'. > > After: > (gdb) print S(42) > $1 = {x = 42} > > Note that no attempt has been made to deal with templates. Hopefully > a follow-on patch can address that. > --- > gdb/NEWS | 5 + > gdb/c-exp.y | 86 +++++++++-- > gdb/eval.c | 55 ++++++++ > gdb/expop.h | 5 + > gdb/testsuite/gdb.cp/infcall-ctors.cc | 128 +++++++++++++++++ > gdb/testsuite/gdb.cp/infcall-ctors.exp | 188 +++++++++++++++++++++++++ > 6 files changed, 457 insertions(+), 10 deletions(-) > create mode 100644 gdb/testsuite/gdb.cp/infcall-ctors.cc > create mode 100644 gdb/testsuite/gdb.cp/infcall-ctors.exp The NEWS part is okay, thanks. Reviewed-By: Eli Zaretskii