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] |
With this patch the compiler now handles properly the use of @ as a prefix of a reference to a discriminated record component and to its bounds. The following must compile quietly in gnat2020 mode: --- procedure Discrs is begin declare -- Discrim-dependent subtypes subtype Index is Integer range 0 .. 123; type R1 (D1 : Index := 0) is record F1 : String (1 .. D1); end record; type R2 (D2 : Index := 0) is record F2 : R1 (D1 => D2); end record; X : R2; begin for I in 1 .. Index'Last loop X := (I, (I, (others => 'A'))); X.F2.F1 (1) := 'B'; X.F2.F1:= 'C' & @ (@'First .. @'Last - 1); X.F2 := (@.D1, 'D' & @.F1 (@.F1'First .. @.F1'Last - 1)); X := (D2 => @.D2, F2 => (D1 => @.D2, F1 => 'E' & @.F2.F1 (@.F2.F1'First .. @.F2.F1'Last - 1))); pragma Assert (X.F2.F1 = (if I <= 4 then String'("EDCB")(1..I) else "EDCB" & (1 .. I-4 => 'A'))); end loop; end; end; Tested on x86_64-pc-linux-gnu, committed on trunk 2017-04-25 Ed Schonberg <schonberg@adacore.com> * sem_ch5.adb (Analyze_Assignment): Reset Full_Analysis flag on the first pass over an assignment statement with target names, to prevent the generation of subtypes (such as discriminated record components)that may carry the target name outside of the tree for the assignment. The subtypes will be generated when the assignment is reanalyzed in full. (Analyze_Target_Name): Handle properly class-wide types.
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] |