aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2024-06-06 12:06:53 +0000
committerMarc Poulhiès <poulhies@adacore.com>2024-06-21 10:34:22 +0200
commit3cc00ccf4b8a866e2265445aa560a2ca00f613b8 (patch)
tree0ff3cf8feeeb4f70863c239110c930c64a9b37c0 /gcc/ada
parent036a37eae64ba6ff73a913fa2f93fc888e4b28b9 (diff)
downloadgcc-3cc00ccf4b8a866e2265445aa560a2ca00f613b8.zip
gcc-3cc00ccf4b8a866e2265445aa560a2ca00f613b8.tar.gz
gcc-3cc00ccf4b8a866e2265445aa560a2ca00f613b8.tar.bz2
ada: Reject ambiguous function calls in interpolated string expressions
When the interpolated expression is a call to an ambiguous call the frontend does not reject it; erroneously accepts the call and generates code that calls to one of them. gcc/ada/ * sem_ch2.adb (Analyze_Interpolated_String_Literal): Reject ambiguous function calls.
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/sem_ch2.adb10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch2.adb b/gcc/ada/sem_ch2.adb
index aae9990..08cc75c 100644
--- a/gcc/ada/sem_ch2.adb
+++ b/gcc/ada/sem_ch2.adb
@@ -25,7 +25,9 @@
with Atree; use Atree;
with Einfo; use Einfo;
+with Einfo.Entities; use Einfo.Entities;
with Einfo.Utils; use Einfo.Utils;
+with Errout; use Errout;
with Ghost; use Ghost;
with Mutably_Tagged; use Mutably_Tagged;
with Namet; use Namet;
@@ -141,6 +143,14 @@ package body Sem_Ch2 is
Str_Elem := First (Expressions (N));
while Present (Str_Elem) loop
Analyze (Str_Elem);
+
+ if Nkind (Str_Elem) = N_Identifier
+ and then Ekind (Entity (Str_Elem)) = E_Function
+ and then Is_Overloaded (Str_Elem)
+ then
+ Error_Msg_NE ("ambiguous call to&", Str_Elem, Entity (Str_Elem));
+ end if;
+
Next (Str_Elem);
end loop;
end Analyze_Interpolated_String_Literal;