===================================================================
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
+-- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -89,9 +89,9 @@
Result := Token = Tok_Arrow;
end if;
- -- If earlier than Ada 2012, check for valid aspect identifier followed
- -- by an arrow, and consider that this is still an aspect specification
- -- so we give an appropriate message.
+ -- If earlier than Ada 2012, check for valid aspect identifier (possibly
+ -- completed with 'CLASS) followed by an arrow, and consider that this
+ -- is still an aspect specification so we give an appropriate message.
else
if Get_Aspect_Id (Token_Name) = No_Aspect then
@@ -100,10 +100,26 @@
else
Scan; -- past aspect name
- if Token /= Tok_Arrow then
- Result := False;
+ Result := False;
- else
+ if Token = Tok_Arrow then
+ Result := True;
+
+ elsif Token = Tok_Apostrophe then
+ Scan; -- past apostrophe
+
+ if Token = Tok_Identifier
+ and then Token_Name = Name_Class
+ then
+ Scan; -- past CLASS
+
+ if Token = Tok_Arrow then
+ Result := True;
+ end if;
+ end if;
+ end if;
+
+ if Result then
Restore_Scan_State (Scan_State);
Error_Msg_SC ("|aspect specification is an Ada 2012 feature");
Error_Msg_SC ("\|unit must be compiled with -gnat2012 switch");
===================================================================
@@ -858,8 +858,8 @@
-- attempt at an aspect specification. The default is more strict for
-- Ada versions before Ada 2012 (where aspect specifications are not
-- permitted). Note: this routine never checks the terminator token
- -- for aspects so it does not matter whether the aspect speficiations
- -- are terminated by semicolon or some other character
+ -- for aspects so it does not matter whether the aspect specifications
+ -- are terminated by semicolon or some other character.
procedure P_Aspect_Specifications
(Decl : Node_Id;