This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ada/15611] Invalid program not detected, RM 3.7(11)
- From: "ludovic at ludovic-brenta dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Nov 2007 21:51:28 -0000
- Subject: [Bug ada/15611] Invalid program not detected, RM 3.7(11)
- References: <bug-15611-286@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from ludovic at ludovic-brenta dot org 2007-11-30 21:51 -------
7.3(15) says that a private type has a partial view and a full view, and the
properties of the partial view apply in some places, and the properties of the
full view apply in other places. So in places where the full view applies, the
type is considered tagged, and cannot have default expressions in the
known_discriminant part.
You seem to imply that the full view does not apply in the completion of the
type, as the full view does not even exist yet. Taking the RM literally, you
may be right but the annotated AARM 3.7(11.b/2) provides guidance:
Defaults for discriminants of tagged types are disallowed so that
every object of a tagged type is constrained, either by an explicit
constraint, or by its initial discriminant values. This substantially
simplifies the semantic rules and the implementation of inherited
dispatching operations. For generic formal types, the restriction
simplifies the type matching rules. If one simply wants a "default"
value for the discriminants, a constrained subtype can be declared for
future use.
I think this rule would be violated for objects of the type declared in the
private part where the full view applies, i.e. you could declare unconstrained
objects of the tagged type.
So, I confirm this to be a bug.
--
ludovic at ludovic-brenta dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15611