Commit 2588c36c by Javier Miranda Committed by Pierre-Marie de Rodat

[Ada] Bit_Order cannot be defined for record extensions

This patch allows the compiler to report an error on Bit_Order when
defined for a record extension.

2018-07-16  Javier Miranda  <miranda@adacore.com>

gcc/ada/

	* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Report an error
	on Bit_Order when defined for a record extension.

gcc/testsuite/

	* gnat.dg/bit_order1.adb: New testcase.

From-SVN: r262712
parent d7925fd3
2018-07-16 Javier Miranda <miranda@adacore.com>
* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Report an error
on Bit_Order when defined for a record extension.
2018-07-16 Arnaud Charlet <charlet@adacore.com>
* libgnat/s-objrea.ads: Minor code clean up.
......
......@@ -5331,6 +5331,12 @@ package body Sem_Ch13 is
Error_Msg_N
("Bit_Order can only be defined for record type", Nam);
elsif Is_Tagged_Type (U_Ent)
and then Is_Derived_Type (U_Ent)
then
Error_Msg_N
("Bit_Order cannot be defined for record extensions", Nam);
elsif Duplicate_Clause then
null;
......
2018-07-16 Javier Miranda <miranda@adacore.com>
* gnat.dg/bit_order1.adb: New testcase.
2018-07-16 Javier Miranda <miranda@adacore.com>
* gnat.dg/iter2.adb, gnat.dg/iter2.ads: New testcase.
2018-07-16 Richard Biener <rguenther@suse.de>
......
-- { dg-do compile }
with System;
procedure Bit_Order1 is
type Sample_Ttype is tagged record
Data : Natural;
end record;
type Other_Type is new Sample_Ttype with record
Other_Data : String (1 .. 100);
end record;
for Other_Type'Bit_Order use System.High_Order_First; -- { dg-error "Bit_Order cannot be defined for record extensions" }
begin
null;
end;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment