aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2008-08-04 12:22:48 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2008-08-04 12:22:48 +0200
commit75ad5042832e9f76566a3f841f9c7701ccd071ee (patch)
treec966183cbce2a77fe3bc728fc78b9578ce83bf62 /gcc
parentd882d0e15ec0aaa63e14ff74d5c5cea488ef84e0 (diff)
downloadgcc-75ad5042832e9f76566a3f841f9c7701ccd071ee.zip
gcc-75ad5042832e9f76566a3f841f9c7701ccd071ee.tar.gz
gcc-75ad5042832e9f76566a3f841f9c7701ccd071ee.tar.bz2
sem_ch4.adb (Analyze_Allocator): If the designated type is a non-null access type and the allocator is not...
2008-08-04 Ed Schonberg <schonberg@adacore.com> * sem_ch4.adb (Analyze_Allocator): If the designated type is a non-null access type and the allocator is not initialized, warn rather than reporting an error. From-SVN: r138600
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_ch4.adb19
1 files changed, 16 insertions, 3 deletions
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 5f23ca2..2129a27 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -498,11 +498,24 @@ package body Sem_Ch4 is
Set_Directly_Designated_Type (Acc_Type, Type_Id);
Check_Fully_Declared (Type_Id, N);
- -- Ada 2005 (AI-231)
+ -- Ada 2005 (AI-231) If the designated type is itself an access
+ -- type that excludes null, it's default initializastion will
+ -- be a null object, and we can insert an unconditional raise
+ -- before the allocator.
if Can_Never_Be_Null (Type_Id) then
- Error_Msg_N ("(Ada 2005) qualified expression required",
- Expression (N));
+ declare
+ Not_Null_Check : constant Node_Id :=
+ Make_Raise_Constraint_Error (Sloc (E),
+ Reason => CE_Null_Not_Allowed);
+ begin
+ if Expander_Active then
+ Insert_Action (N, Not_Null_Check);
+ Analyze (Not_Null_Check);
+ else
+ Error_Msg_N ("null value not allowed here?", E);
+ end if;
+ end;
end if;
-- Check restriction against dynamically allocated protected