This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Tested on i686-linux, committed on trunk
Deferred constants can appear in package bodies, and be completed with
a pragma Import. The check for completion of such constants was simply
missing. In most cases a use of such a constant will be detected as a
premature use (before freezing) but in cases involving subtypes of
discriminated types the error shows itself as an undefined entity in gigi.
Compilation of the following package must yield the message:
--
p.adb:2:04: constant declaration requires initialization expression
--
package P is
pragma elaborate_body;
type Int (D: Boolean := False) is null record;
type Pair is record
X : Int;
Y : Integer;
end record;
end P;
--
package body P is
X : constant Int (True);
P : constant Pair := (X, 15);
end;
This change also fixes the circuitry that handles remote access-to-classwide
types (which ensures that the bodies for their calling stubs and stream
attributes are attached at appropriate points in the tree) to process
correctly RACW types that are declared in nested packages.
2007-04-06 Ed Schonberg <schonberg@adacore.com>
Thomas Quinot <quinot@adacore.com>
* sem_ch7.ads, sem_ch7.adb (Inspect_Deferred_Constant_Completion): Move
out of Analyze_Package_Declaration, because processing must be applied
to package bodies as well, for deferred constants completed by pragmas.
(Analyze_Package_Declaration): When the package declaration being
analyzed does not require an explicit body, call Check_Completion.
(May_Need_Implicit_Body): An implicit body is required when a package
spec contains the declaration of a remote access-to-classwide type.
(Analyze_Package_Body): If the package contains RACWs, append the
pending subprogram bodies generated by exp_dist at the end of the body.
(New_Private_Type,Unit_Requires_Body): Split Is_Abstract flag into
Is_Abstract_Subprogram and Is_Abstract_Type.
(Preserve_Full_Attributes): The full entity list is not an attribute
that must be preserved from full to partial view.
* sem_dist.adb (Add_RAS_Dereference_TSS):
Change primitive name to _Call so it cannot clash with any legal
identifier, and be special-cased in Check_Completion.
Mark the full view of the designated type for the RACW associated with
a RAS as Comes_From_Source to get proper view switching when installing
private declarations.
Provite a placeholder nested package body along with the nested spec
to have a place for Append_RACW_Bodies to generate the calling stubs
and stream attributes.
Attachment:
difs
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |