diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-07-31 11:35:27 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-07-31 11:35:27 +0200 |
commit | 2fe258bf9315fa25f620860f99462faa8ade3b68 (patch) | |
tree | 21f95046f305aca90426a00385169c1ba85dc433 /gcc/ada/exp_ch3.adb | |
parent | b4dfdc11a5440c5aaf0a86d011facaddc61806be (diff) | |
download | gcc-2fe258bf9315fa25f620860f99462faa8ade3b68.zip gcc-2fe258bf9315fa25f620860f99462faa8ade3b68.tar.gz gcc-2fe258bf9315fa25f620860f99462faa8ade3b68.tar.bz2 |
[multiple changes]
2014-07-31 Robert Dewar <dewar@adacore.com>
* sem_ch13.adb: Minor reformatting.
2014-07-31 Ed Schonberg <schonberg@adacore.com>
* exp_ch3.adb (Build_Invariant_Checks): If the enclosing record
is an unchecked_union, warn that invariants will not be checked
on components that have them.
2014-07-31 Robert Dewar <dewar@adacore.com>
* freeze.adb (Freeze_Entity): Check for error of
Type_Invariant'Class applied to a untagged type.
* sem_ch6.adb (Analyze_Null_Procedure): Unconditionally rewrite
as null body, so that we perform error checks even if expansion
is off.
From-SVN: r213324
Diffstat (limited to 'gcc/ada/exp_ch3.adb')
-rw-r--r-- | gcc/ada/exp_ch3.adb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 520f932..53985f1 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -3763,7 +3763,15 @@ package body Exp_Ch3 is if Has_Invariants (Etype (Id)) and then In_Open_Scopes (Scope (R_Type)) then - Append_To (Stmts, Build_Component_Invariant_Call (Id)); + if Has_Unchecked_Union (R_Type) then + Error_Msg_NE + ("invariants cannot be checked on components of " + & "unchecked_union type&?", Decl, R_Type); + return Empty_List; + + else + Append_To (Stmts, Build_Component_Invariant_Call (Id)); + end if; elsif Is_Access_Type (Etype (Id)) and then not Is_Access_Constant (Etype (Id)) |