diff options
author | Yannick Moy <moy@adacore.com> | 2021-07-27 12:20:41 +0200 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-09-22 15:01:50 +0000 |
commit | 03b6cc3b3e60379f10a4b055e431488ab10a1760 (patch) | |
tree | c394a714942f94e3ac88c4562ca24a5a8c4caf58 | |
parent | c0471c61e1f3bcd86e819f2e6b5e054f80572a41 (diff) | |
download | gcc-03b6cc3b3e60379f10a4b055e431488ab10a1760.tar.gz |
[Ada] Spurious error on deferred constant with predicate
gcc/ada/
* sem_ch3.adb (Analyze_Object_Declaration): Do not insert a
predicate check after a deferred constant declaration.
-rw-r--r-- | gcc/ada/sem_ch3.adb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 0e36cc22837..7ba6f7b3bf9 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -4505,7 +4505,7 @@ package body Sem_Ch3 is -- default initial value (including via a Default_Value or -- Default_Component_Value aspect, see AI12-0301) and then this is not -- an internal declaration whose initialization comes later (as for an - -- aggregate expansion). + -- aggregate expansion) or a deferred constant. -- If expression is an aggregate it may be expanded into assignments -- and the declaration itself is marked with No_Initialization, but -- the predicate still applies. @@ -4519,6 +4519,7 @@ package body Sem_Ch3 is (Present (E) or else Is_Partially_Initialized_Type (T, Include_Implicit => False)) + and then not (Constant_Present (N) and then No (E)) then -- If the type has a static predicate and the expression is known at -- compile time, see if the expression satisfies the predicate. |