diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2022-04-22 22:27:22 +0200 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2022-05-30 08:29:02 +0000 |
commit | 79b7ab68bce24103adc388d184ff74755914cdda (patch) | |
tree | f02eb4d6bde2d0e8a4528457ed223a0b984363c7 | |
parent | 764169055b5b083f1f2167122c637ddc72c58095 (diff) | |
download | gcc-79b7ab68bce24103adc388d184ff74755914cdda.zip gcc-79b7ab68bce24103adc388d184ff74755914cdda.tar.gz gcc-79b7ab68bce24103adc388d184ff74755914cdda.tar.bz2 |
[Ada] Do not analyze expression functions for dispatch tables
There is no need to analyze expression functions that are primitives of a
tagged type for its dispatch table because they will be analyzed at the end
of the current scope.
gcc/ada/
* sem_attr.adb (Resolve_Attribute) <Attribute_Access>: Don't analyze
the body of an expression function in the case of a dispatch table.
-rw-r--r-- | gcc/ada/sem_attr.adb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 7b05cdc..e6e06f6 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -12144,11 +12144,15 @@ package body Sem_Attr is elsif Scope (Subp_Id) /= Current_Scope then null; + -- Dispatch tables are not a freeze point either + + elsif Nkind (Parent (N)) = N_Unchecked_Type_Conversion + and then Is_Dispatch_Table_Entity (Etype (Parent (N))) + then + null; + -- Analyze the body of the expression function to freeze - -- the expression. This takes care of the case where the - -- 'Access is part of dispatch table initialization and - -- the generated body of the expression function has not - -- been analyzed yet. + -- the expression. else Analyze (Subp_Body); |