diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-06 07:56:04 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-06 07:56:04 +0000 |
commit | e406b8652f67bb343be2ab2853d3620847464709 (patch) | |
tree | 5790cdfb649d8d249baa5d5f8a5f5e430365abc1 /gcc/ada/sem_ch12.adb | |
parent | aa5f4f3291a93a0e4833deb79fd86f3233d7a3c4 (diff) | |
download | gcc-e406b8652f67bb343be2ab2853d3620847464709.tar.gz |
2008-08-06 Ed Schonberg <schonberg@adacore.com>
* sem_ch3.adb (Process_Discriminants): diagnose redundant or improper
null exclusion in a discriminant declaration
* sem_ch8.adb (Analyze_Object_Renaming): diagnose null exclusion
indicators when type is not an access type.
* sem_ch12.adb (Formal_Object_Declaration): diagnose null exclusion
indicators when type is not an access type.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138765 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_ch12.adb')
-rw-r--r-- | gcc/ada/sem_ch12.adb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 82b47aa17a6..30628b6864a 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -1812,12 +1812,16 @@ package body Sem_Ch12 is -- Verify that there is no redundant null exclusion. - if Null_Exclusion_Present (N) - and then Can_Never_Be_Null (T) - then - Error_Msg_NE - ("`NOT NULL` not allowed (& already excludes null)", - N, T); + if Null_Exclusion_Present (N) then + if not Is_Access_Type (T) then + Error_Msg_N + ("null exclusion can only apply to an access type", N); + + elsif Can_Never_Be_Null (T) then + Error_Msg_NE + ("`NOT NULL` not allowed (& already excludes null)", + N, T); + end if; end if; -- Ada 2005 (AI-423): Formal object with an access definition |