diff options
Diffstat (limited to 'gcc/ada/sem_ch5.adb')
-rw-r--r-- | gcc/ada/sem_ch5.adb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index d37b951..42db689 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2003 Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2004 Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -397,6 +397,20 @@ package body Sem_Ch5 is Propagate_Tag (Lhs, Rhs); end if; + -- Ada 0Y (AI-231) + + if Extensions_Allowed + and then Nkind (Rhs) = N_Null + and then Is_Access_Type (T1) + and then not Assignment_OK (Lhs) + and then ((Is_Entity_Name (Lhs) + and then Can_Never_Be_Null (Entity (Lhs))) + or else Can_Never_Be_Null (Etype (Lhs))) + then + Error_Msg_N + ("(Ada 0Y) NULL not allowed in null-excluding objects", Lhs); + end if; + if Is_Scalar_Type (T1) then Apply_Scalar_Range_Check (Rhs, Etype (Lhs)); |