r260592 - in /trunk/gcc/ada: ChangeLog sem_prag...

pmderodat@gcc.gnu.org pmderodat@gcc.gnu.org
Wed May 23 10:23:00 GMT 2018


Author: pmderodat
Date: Wed May 23 10:23:29 2018
New Revision: 260592

URL: https://gcc.gnu.org/viewcvs?rev=260592&root=gcc&view=rev
Log:
[Ada] Implementation of AI12-0131: legality of class-wide precondition

This patch refines the legality check on a class-wide precondition on a type
extension when ancestor does not have a class-wide precondition. Previously the
compiler accepted such a precondition when the ancestor had a class-wide
postcondition.

Compiling pck.ads must yield:

  pck.ads:7:04: illegal class-wide precondition on overriding operation

----
package Pck is
   type Parent is tagged null record;
   procedure Init (P : Parent) with Post'Class => True;

   type Child is new Parent with null record;
   overriding procedure Init (C : Child) with
   Pre'Class => True;
end Pck;

2018-05-23  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* sem_prag.adb (Inherit_Class_Wide_Pre): Refine legality check on
	class-wide precondition on a type extension when ancestor does not have
	a class-wide precondition.  Previously the compiler accepted such a
	precondition when the ancestor had a class-wide postcondition.

Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/sem_prag.adb



More information about the Gcc-cvs mailing list