diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-03-19 17:27:18 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-03-19 17:27:18 +0100 |
commit | a49565158271693fa8f994ba9b35f00b9ee25028 (patch) | |
tree | a928f3a0c12dc473d86f6fa4b138d002407c7f64 /gcc/ada/sem_ch4.adb | |
parent | 04398fa84e070560d18d59ffe898bd46e8ddbeb7 (diff) | |
download | gcc-a49565158271693fa8f994ba9b35f00b9ee25028.zip gcc-a49565158271693fa8f994ba9b35f00b9ee25028.tar.gz gcc-a49565158271693fa8f994ba9b35f00b9ee25028.tar.bz2 |
[multiple changes]
2012-03-19 Hristian Kirtchev <kirtchev@adacore.com>
* sem_ch4.adb (Analyze_Allocator): Detect an allocator generated
by the build-in-place machinery where the designated type is
indefinite, but the underlying type is not. Do not emit errors
related to missing initialization in this case.
2012-03-19 Robert Dewar <dewar@adacore.com>
* gnat_ugn.texi: Add documentation for -gnateinnn switch.
* sem_elab.adb, put_alfa.adb, lib-xref-alfa.adb: Minor reformatting.
* sem_prag.adb: Minor comment update.
From-SVN: r185525
Diffstat (limited to 'gcc/ada/sem_ch4.adb')
-rw-r--r-- | gcc/ada/sem_ch4.adb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index ffc3a27..d56da36 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -661,9 +661,22 @@ package body Sem_Ch4 is if Is_Indefinite_Subtype (Type_Id) and then Serious_Errors_Detected = Sav_Errs then - if Is_Class_Wide_Type (Type_Id) then + -- The build-in-place machinery may produce an allocator when + -- the designated type is indefinite but the underlying type is + -- not. In this case the unknown discriminants are meaningless + -- and should not trigger error messages. Check the parent node + -- because the allocator is marked as coming from source. + + if Present (Underlying_Type (Type_Id)) + and then not Is_Indefinite_Subtype (Underlying_Type (Type_Id)) + and then not Comes_From_Source (Parent (N)) + then + null; + + elsif Is_Class_Wide_Type (Type_Id) then Error_Msg_N ("initialization required in class-wide allocation", N); + else if Ada_Version < Ada_2005 and then Is_Limited_Type (Type_Id) |