diff options
author | Justin Squirek <squirek@adacore.com> | 2021-11-30 23:40:40 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2022-01-06 17:11:34 +0000 |
commit | 1f26ff11b688e3cec00da85b13f6f33e23fc7410 (patch) | |
tree | aef0ab468460253d75f67e5d16c5bfbbfb8f3ce7 /gcc/ada/sem_attr.adb | |
parent | 0590ed7248a46c06c9f0d166af7eb8c9bb046a66 (diff) | |
download | gcc-1f26ff11b688e3cec00da85b13f6f33e23fc7410.zip gcc-1f26ff11b688e3cec00da85b13f6f33e23fc7410.tar.gz gcc-1f26ff11b688e3cec00da85b13f6f33e23fc7410.tar.bz2 |
[Ada] Spurious error when using current instance of type
gcc/ada/
* exp_ch3.adb (Build_Assignment): Replace current instance of
type with Init_Proc formal.
* sem_attr.adb (OK_Self_Reference): Handle recognition of
Current_Instance to detect certain expansion.
* sem_ch4.adb (Analyze_One_Call): Set actual's type when the
actual in question is a current instance and its corresponding
formal is an incomplete type.
* sem_util.adb (Is_Current_Instance): Add check for incomplete
views and add comment.
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r-- | gcc/ada/sem_attr.adb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 4344885..30bd335 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -989,7 +989,15 @@ package body Sem_Attr is Set_Etype (P, Typ); end if; - if Typ = Scop then + -- A current instance typically appears immediately within + -- the type declaration, but may be nested within an internally + -- generated temporary scope - as for an aggregate of a + -- discriminated component. + + if Typ = Scop + or else (In_Open_Scopes (Typ) + and then not Comes_From_Source (Scop)) + then declare Q : Node_Id := Parent (N); |