aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/synth/synth-decls.adb6
-rw-r--r--src/synth/synth-values.adb1
2 files changed, 6 insertions, 1 deletions
diff --git a/src/synth/synth-decls.adb b/src/synth/synth-decls.adb
index f3ceb64a1..79708f878 100644
--- a/src/synth/synth-decls.adb
+++ b/src/synth/synth-decls.adb
@@ -440,7 +440,11 @@ package body Synth.Decls is
-- For constant functions, the value must be constant.
pragma Assert (not Get_Instance_Const (Syn_Inst)
or else Is_Const (Val));
- Cst := Create_Value_Const (Val, Decl);
+ if Val.Kind = Value_Const then
+ Cst := Val;
+ else
+ Cst := Create_Value_Const (Val, Decl);
+ end if;
Create_Object_Force (Syn_Inst, First_Decl, Cst);
end if;
end Synth_Constant_Declaration;
diff --git a/src/synth/synth-values.adb b/src/synth/synth-values.adb
index 8a9cbaa5b..58fc892ac 100644
--- a/src/synth/synth-values.adb
+++ b/src/synth/synth-values.adb
@@ -580,6 +580,7 @@ package body Synth.Values is
subtype Value_Type_Const is Value_Type (Value_Const);
function Alloc is new Areapools.Alloc_On_Pool_Addr (Value_Type_Const);
begin
+ pragma Assert (Val = null or else Val.Kind /= Value_Const);
return To_Value_Acc (Alloc (Current_Pool,
(Kind => Value_Const,
C_Val => Val,