Patchwork [Ada] Spurious errors on aggregates in instances

login
register
mail settings
Submitter Arnaud Charlet
Date Aug. 31, 2011, 9:34 a.m.
Message ID <20110831093410.GA19980@adacore.com>
Download mbox | patch
Permalink /patch/112486/
State New
Headers show

Comments

Arnaud Charlet - Aug. 31, 2011, 9:34 a.m.
In an instance, errors that report that an aggregate (sub)component is limited
must be ignaored because they originate in view conflicts. If the original
aggregate is legal and the actuals are legal, the aggregate in the instance
itself is legal.

No simple example available.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-08-31  Ed Schonberg  <schonberg@adacore.com>

	* sem_aggr.adb (Resolve_Aggregate): In an instance, ignore aggregate
	subcomponents tnat may be limited, because they originate in view
	conflicts. If the original aggregate is legal and the actuals are
	legal, the aggregate itself is legal.

Patch

Index: sem_aggr.adb
===================================================================
--- sem_aggr.adb	(revision 178358)
+++ sem_aggr.adb	(working copy)
@@ -1052,8 +1052,14 @@ 
       end if;
 
       --  Ada 2005 (AI-287): Limited aggregates allowed
+      --  In an instance, ignore aggregate subcomponents tnat may be limited,
+      --  because they originate in view conflicts. If the original aggregate
+      --  is legal and the actuals are legal, the aggregate itself is legal.
 
-      if Is_Limited_Type (Typ) and then Ada_Version < Ada_2005 then
+      if Is_Limited_Type (Typ)
+        and then Ada_Version < Ada_2005
+        and then not In_Instance
+      then
          Error_Msg_N ("aggregate type cannot be limited", N);
          Explain_Limited_Type (Typ, N);