[gcc r16-1224] ada: Tweak condition for name resolution failure
Marc Poulhies
dkm@gcc.gnu.org
Fri Jun 6 08:41:22 GMT 2025
https://gcc.gnu.org/g:8727813200bf75c0f1ad22edd49c271a92831882
commit r16-1224-g8727813200bf75c0f1ad22edd49c271a92831882
Author: Ronan Desplanques <desplanques@adacore.com>
Date: Fri Feb 21 17:32:35 2025 +0100
ada: Tweak condition for name resolution failure
It is sometimes used as a convention across GNAT's code to set the Etype
field of a node to Any_Type to signal a name resolution error. This has
the potential to be confusing, which is why this patch replaces one such
use of the convention by a less convoluted check.
This only affects error recovery paths, and possibly doesn't change the
behavior of the compiler at all.
gcc/ada/ChangeLog:
* sem_ch4.adb (Analyze_Selected_Component): Tweak condition.
Diff:
---
gcc/ada/sem_ch4.adb | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 50b3eee0dbe5..d910d770ad3a 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -6040,9 +6040,10 @@ package body Sem_Ch4 is
Error_Msg_NE ("invalid prefix in selected component&", N, Sel);
end if;
- -- If N still has no type, the component is not defined in the prefix
+ -- If the selector is not labelled with an entity at this point, the
+ -- component is not defined in the prefix.
- if Etype (N) = Any_Type then
+ if No (Entity (Sel)) then
if Is_Single_Concurrent_Object then
Error_Msg_Node_2 := Entity (Pref);
More information about the Gcc-cvs
mailing list