This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Proper detection of errors in variant choices


This is part of the previous work on getting variant choices that
involve a statically predicated subtype to work. The one gap was
in the generic case, where we were detecting the error on instances
instead of the template (this also called a failure of ACATS test
B49007A, where we had lots such a message).

The following test compiles with the indicated output:

     1. PROCEDURE MISSNONSTV  IS
     2.    TYPE INT IS RANGE 1 .. 10;
     3. BEGIN
     4.    DECLARE
     5.       GENERIC
     6.          OBJ1 : IN INT;
     7.       PACKAGE PACK IS
     8.          TYPE ER_REC (AT1 : INT := 4) IS RECORD
     9.             CASE AT1 IS
    10.                WHEN OBJ1 =>                     -- ERROR: (D).
                            |
        >>> choice given in variant part is not static
        >>> "OBJ1" is not static constant or named number (RM 4.9(5))

    11.                   TR : INTEGER RANGE 1 .. 10;
    12.                WHEN OTHERS =>
    13.                   TY : BOOLEAN := TRUE;
    14.             END CASE;
    15.          END RECORD;
    16.       END PACK;
    17.    BEGIN
    18.       null;
    19.    END;
    20. end MISSNONSTV;

Tested on x86_64-pc-linux-gnu, committed on trunk

2013-10-10  Robert Dewar  <dewar@adacore.com>

	* freeze.adb: Minor reformatting.
	* sem_ch13.adb (Freeze_Entity_Checks): New procedure
	(Analyze_Freeze_Entity): Call Freeze_Entity_Checks
	(Analyze_Freeze_Generic_Entity): Call Freeze_Entity_Checks.
	* sinfo.ads: Add syntax for sprint for Freeze_Generic_Entity.
	* sprint.ads: Add syntax for freeze generic entity node.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]