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] Legality of aspects specified on a full view


In Ada 2012, certain aaspects, such as Type_Invariant, can be specified on a
partial view of a type, or on the full view, but not in both This patch
rejects such duplications cleanly.

the command:

    gcc -c -gnat12 -gnata r.ads

must yield:

    r.ads:5:32: aspect already specified in private declaration

---
package R is
    type T is private with Type_Invariant => Non_Null (T);
    function Non_Null (X : T) return Boolean;
private
    type T is new Integer with Type_Invariant => T /= 0;
    function Non_Null (X : T) return Boolean is (X /= 0);
end R;

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

2012-10-04  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb (Check_Duplicate_Aspects): Diagnose properly
	aspects that appear in the partial and the full view of a type.

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]