aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2024-06-06 11:48:02 +0000
committerMarc Poulhiès <dkm@gcc.gnu.org>2024-06-27 10:19:12 +0200
commit089bb078e8663f72292f2edc63f48c304dcb1ccc (patch)
tree372dcbcf5afa19984e44cbbd43a5c90042862f3b /gcc/ada
parent60ca71044e8e4d492c74f65f6093fbcf46d238bb (diff)
downloadgcc-089bb078e8663f72292f2edc63f48c304dcb1ccc.zip
gcc-089bb078e8663f72292f2edc63f48c304dcb1ccc.tar.gz
gcc-089bb078e8663f72292f2edc63f48c304dcb1ccc.tar.bz2
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.
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/sem_res.adb7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index a0dd1f7..72bba1f 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