[gcc r15-1683] ada: Bug using user defined string literals with interpolated strings
Marc Poulhi?s
dkm@gcc.gnu.org
Thu Jun 27 08:25:00 GMT 2024
https://gcc.gnu.org/g:089bb078e8663f72292f2edc63f48c304dcb1ccc
commit r15-1683-g089bb078e8663f72292f2edc63f48c304dcb1ccc
Author: Javier Miranda <miranda@adacore.com>
Date: Thu Jun 6 11:48:02 2024 +0000
ada: Bug using user defined string literals with interpolated strings
The frontend rejects the use of user defined string literals
using interpolated strings.
gcc/ada/
* sem_res.adb (Has_Applicable_User_Defined_Literal): Add missing
support for interpolated strings.
Diff:
---
gcc/ada/sem_res.adb | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index a0dd1f7962b..72bba1f97af 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -467,7 +467,7 @@ package body Sem_Res is
Literal_Aspect_Map :
constant array (N_Numeric_Or_String_Literal) of Aspect_Id :=
(N_Integer_Literal => Aspect_Integer_Literal,
- N_Interpolated_String_Literal => No_Aspect,
+ N_Interpolated_String_Literal => Aspect_String_Literal,
N_Real_Literal => Aspect_Real_Literal,
N_String_Literal => Aspect_String_Literal);
@@ -487,6 +487,7 @@ package body Sem_Res is
begin
if (Nkind (N) in N_Numeric_Or_String_Literal
+ | N_Interpolated_String_Literal
and then Present
(Find_Aspect (Typ, Literal_Aspect_Map (Nkind (N)))))
or else
@@ -563,6 +564,10 @@ package body Sem_Res is
Param1 := Make_String_Literal (Loc, Strval (N));
Params := New_List (Param1);
+ elsif Nkind (N) = N_Interpolated_String_Literal then
+ Param1 := New_Copy_Tree (N);
+ Params := New_List (Param1);
+
else
Param1 :=
Make_String_Literal
More information about the Gcc-cvs
mailing list