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]

[Ada] Prevent use of attribute definitions for renamings


The RM forbids local names from being renamings, hence the
attempt to specify an attribute such as size or alignment
for a renaming should be illegal. We detected this for the
case of an address clause but missed many other cases.

The following should compile with the messages shown
with -gnatj60 -gnatld7

     1. package BadRenameAttr is
     2.    type r is record
     3.       a, b, c, d : Character;
     4.    end record;
     5.
     6.    B : R;
     7.    C : R renames B;
     8.    for C'Alignment use 8;
               |
        >>> alignment clause not allowed for a renaming
            declaration (RM 13.1(6))

     9.
    10.    D : R renames B;
    11.    for D'Size use 128;
               |
        >>> size clause not allowed for a renaming
            declaration (RM 13.1(6))

    12. end;

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

2011-12-20  Robert Dewar  <dewar@adacore.com>

	* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Check
	renaming case.

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]