From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9DC763840C23; Sun, 14 Jun 2020 05:21:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9DC763840C23 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1592112090; bh=iICXJu+b3cY6ScdRkJwj6vG+KtymNwF0MtRowr0+Xg8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dz6wPbMnHYl8m8B6UuiORFhUm0X2yXXwLAmNr5Mgz8TlQ0YPbOcONzNYNGIdfLnJu SnrqtLUhhqYLKhfOAWkdH0S/akwWkmzFM00eq1dFRVr4cutABTj4PAVatWcoWoaXXu gkDQNSb6dHoaI6u/8YKm436yPuXX5CDXWR1xDEbg= From: "rosen at adalog dot fr" To: gcc-bugs@gcc.gnu.org Subject: [Bug ada/95664] generic instantiation fails to detect abstract equality, builds with gcc-9 and fails to link with gcc-10 Date: Sun, 14 Jun 2020 05:21:30 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ada X-Bugzilla-Version: 10.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rosen at adalog dot fr X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Jun 2020 05:21:30 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95664 Jean-Pierre Rosen changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rosen at adalog dot fr --- Comment #2 from Jean-Pierre Rosen --- This is fixed in the development version of AdaControl. Patch: - package Declarations_Store is new Scope_Manager.Scoped_Store (Asis.Declaration); + package Declarations_Store is new Scope_Manager.Scoped_Store (Asis.Declaration, +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 Equivalent_Keys =3D> Asis.Elements.Is_Equal); There is a hole in the language about this case. I reported to AdaCore, and here is Tucker Taft's response: After looking through the RM, it seems that the use of an abstract "=3D"= in this context is not directly covered, but the closest thing is the rule abo= ut what happens when you wrap a type with an abstract "=3D" into a record or a= rray type. The abstract "=3D" raises Program_Error if it is ever invoked. See = RM 4.5.2 (24.1/3): 24.1/3 {AI05-0123-1} If the primitive equals operator for an untagged record typ= e is abstract, then Program_Error is raised at the point of any (implicit) call = to that abstract subprogram.=20 24.f/3 Reason: An explicit call to an abstract subprogram is illegal. This rule is needed in order to define the effect of an implicit call such as a call tha= t is part of the predefined equality operation for an enclosing composite type t= hat has a component of an untagged record type that has an abstract primitive equals operator. For tagged types, an abstract primitive equals operator is only allowed for an abstract type, and abstract types cannot be components,= so this case does not occur.=20 So my sense is that this should *not* be a compile-time error, but rather r= aise Program_Error if the "=3D" operator of the formal type is invoked. We also should write up an AI to at least clarify this particular case. We could try to make this illegal in the generic spec, but clearly we cannot make it illegal in the generic body, because of contract issues. But I thi= nk the same argument applies here, namely that there is no need to disallow th= is instantiation, unless "=3D" is actually used, which argues for raising Program_Error rather than making it illegal.=