From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id AC58F3882052 for ; Thu, 13 Jun 2024 13:34:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AC58F3882052 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AC58F3882052 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::331 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718285648; cv=none; b=gStllDWZR81acc0cOKpoJRbvIEp6Hq8cBJEhm18OfNGJRl7NJs9Y2gr9t215p79Ylvq6oj4+igGOtmJCvhemyewILX1Eau6B1jNlJ0vRc12q8Ee7I6jEDl2Vt0e0WAI69AjKOZSEEF5l3rfgcTeyBxcT84oE3TMzg0KDUOMUGUw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718285648; c=relaxed/simple; bh=tb5M3X1xgbT+MG2GTdK+fP/2onyNr1/YM5Q/vV4sbUc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=W8J5Vzz80j4vMNja0n7WsDFTpkIa59LsXAbqvBkMGTRUdWf3kBS2crbuhNPC2zOElFiZZplks3vXvZlRl8GLqEhJo+1ECZIhc8+QkdPW+TgQG9BQJ0a40CsgUfYps6nBQYhYrwhpn3l6zZIW6XG8QGqQLlz01MfcODiLQ7DJgmM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4217926991fso9982315e9.3 for ; Thu, 13 Jun 2024 06:34:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1718285642; x=1718890442; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wFmek1K3CtWnKlIYTjKjpkV7mNa7QgNoJzo4FXcwt5c=; b=VUUuZ/EdmBD2CoA5Wf/ReKmWCFpd/BYWZFGPWwu7wsG0yDRMsRglCorKlNfMEIRAb8 0ARHVpWpEeEgGqefJZFmt4xxkoicmcp7GziRIrAmqv9O+Hx3JOpIvsquQBE0ICd0ceO8 hvV0QtAsBchRG6KsZCNXpJtXmcJL31yrERgkTUpeO3EFID672pp3gXz7IfD9opwtIVG8 E7lr6+HR17yKK6JNxz0+Wffkya2AveF++YH3lVmpi542muYC9GQW3Jk1fVosFkQuOYU6 oT7P4AKTBay73H/n25vvyoyeJB0cD7BE2dyhPQaQ1wa6q9+7g4daAnigddJ5JTxC9uaF WpRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718285642; x=1718890442; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wFmek1K3CtWnKlIYTjKjpkV7mNa7QgNoJzo4FXcwt5c=; b=fNE4yU1JGKj/0+D3YZxxq6zE/UgsT6J4+i8BpPxXjztYTHwsQLwD6RePSE3ZT1h2ci DWa9Oa/P7eRyVTxv5kJ+KmE9+CH2uYIRShSk0ASQeFVOkzxQvUh+Dmdt1Ln9f1MvzBBA 3kUiUe7C4pW4ec0NTCjNtGWrSQW6olRNHBm7da9a5LIeJszlglY5W2y2s/rTwiLOPXes frZEW7tKuHtTno52Q6YRqZivBdLEyP2IDpfCMCe/IPedAu21tU/Pl/ajeO4SRoiPxJ6z UHTfXBVck/snpY4YLDlLQZk5NzSiTx2j7L+kto+CpYVVmila31zN/EXWjTD3JyOyyvGF sSKw== X-Gm-Message-State: AOJu0Yy5iMg5Lo6u8z7flb3TsYzAAQAW+uB+DzIkF4PxwSb2gCuRg9tg 7mlTowicBc7yoNZsFXa9Q15jflVOJWgZFMOKyRJ9CccKFHtD9fW8jgRWl2Iiu0x+rZAEXlPYqOw = X-Google-Smtp-Source: AGHT+IHuRupQtJ3FTsTPocetCfCFGgpIyjdT7nMKmBq4SkdL1ULq+9myNLYTgKakoJIjlOSDa7O3ow== X-Received: by 2002:a05:600c:3b15:b0:422:4fcd:d4b3 with SMTP id 5b1f17b1804b1-422866bfc37mr37236925e9.37.1718285642476; Thu, 13 Jun 2024 06:34:02 -0700 (PDT) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422870e9145sm62391955e9.22.2024.06.13.06.34.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 06:34:02 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Javier Miranda Subject: [COMMITTED 16/30] ada: Interfaces order disables class-wide prefix notation calls Date: Thu, 13 Jun 2024 15:33:22 +0200 Message-ID: <20240613133338.1809385-16-poulhies@adacore.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613133338.1809385-1-poulhies@adacore.com> References: <20240613133338.1809385-1-poulhies@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Javier Miranda When the first formal parameter of a subprogram is a class-wide interface type (or an access to a class-wide interface type), changing the order of the interface types implemented by a type declaration T enables or disables the ability to use the prefix notation to call it with objects of type T. When the call is disabled the compiler rejects it reporting an error. gcc/ada/ * sem_ch4.adb (Traverse_Interfaces): Add missing support for climbing to parents of interface types. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch4.adb | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 03364dade9f..b59a56c139b 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -9805,11 +9805,23 @@ package body Sem_Ch4 is begin Error := False; + -- When climbing through the parents of an interface type, + -- look for acceptable class-wide homonyms associated with + -- the interface type. + + if Is_Interface (Anc_Type) then + Traverse_Homonyms (Anc_Type, Error); + + if Error then + return; + end if; + end if; + Intface := First (Intface_List); while Present (Intface) loop -- Look for acceptable class-wide homonyms associated with the - -- interface. + -- interface type. Traverse_Homonyms (Etype (Intface), Error); @@ -9828,6 +9840,15 @@ package body Sem_Ch4 is Next (Intface); end loop; + + -- For derived interface types continue the search climbing to + -- the parent type. + + if Is_Interface (Anc_Type) + and then Etype (Anc_Type) /= Anc_Type + then + Traverse_Interfaces (Etype (Anc_Type), Error); + end if; end Traverse_Interfaces; -- Start of processing for Try_Class_Wide_Operation -- 2.45.1