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]

Re: [PATCH] ada/36777: A protected type may denote the current protected object


Samuel Tardieu wrote:

According to RM 9.4(21/2), within the declaration or body of a
protected object other than in an access_definition, the name of
the protected type denotes the current instance.

This patch allows attributes to be applied properly in this case.
The prefix is rewritten to the current instance when appropriate,
and an error message is issued when an instance is used instead
of a type.

The "protected_self_ref1.adb" should compile and run without error,
while "protected_self_ref2.adb" will issue the following error:

    12.          D := P'Digits;
                      |
        >>> prefix of "Digits" attribute denotes current instance (RM 9.4(21/2))

Tested on i686-pc-linux-gnu. Ok for trunk?

Yes, this patch is fine. Tested against full regression suite, and interestingly, there is no instance of this anywhere in the ACATS
tests or any other tests so far. Clearly an omission in the Ada 2005
ACATS tests, I supposed we should point it out to Randy :-)


Thanks for the fix

Robert Dewar


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]