[gcc r15-1525] ada: Reject ambiguous function calls in interpolated string expressions
Marc Poulhi?s
dkm@gcc.gnu.org
Fri Jun 21 08:38:42 GMT 2024
https://gcc.gnu.org/g:3cc00ccf4b8a866e2265445aa560a2ca00f613b8
commit r15-1525-g3cc00ccf4b8a866e2265445aa560a2ca00f613b8
Author: Javier Miranda <miranda@adacore.com>
Date: Thu Jun 6 12:06:53 2024 +0000
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.
Diff:
---
gcc/ada/sem_ch2.adb | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/gcc/ada/sem_ch2.adb b/gcc/ada/sem_ch2.adb
index aae9990eb4d9..08cc75c9104c 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;
More information about the Gcc-cvs
mailing list