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] Illegal declarations of deferred constants


A deferred constant whose type is an anonymous array is always illegal (unless
it is imported). This patch makes the error message more detailed, to help
future Ada beginners.

Compiling array_constant.ads  must yield:

   array_constant.ads:2:17: a deferred constant must have a named type
   array_constant.ads:4:04: type does not match declaration at line 2
   array_constant.ads:4:04: each anonymous array is a distinct type

---
package Array_Constant is
   A : constant array (Boolean) of Integer;
private
   A : constant array (Boolean) of Integer := (
     True => 1, False => 0
   );
end Array_Constant;

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

2014-10-23  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb (Constant_Redeclaration): Make error message more
	explicit on a deferred constant whose object_definition is an
	anonymous array.

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]