Compiling wrong_aspect.ads must yield:

    wrong_aspect.ads:8:62: aspect identifier expected
    wrong_aspect.ads:10:50: aspect identifier expected
    wrong_aspect.ads:12:50: aspect identifier expected

---
package Wrong_Aspect is
   type Bits_1 is mod 2**1 with Size => 1;
   type Bits_2 is mod 2**2 with Size => 2;
   type Bits_4 is mod 2**4 with Size => 4;

   type Word_1 is array (0 .. 31) of Bits_1 with Size => 32, Pack;

   type Word_2 is array (0 .. 15) of Bits_2 with Size => 32, Packed;

   type Word_3 is array (0 .. 15) of Bits_2 with Packed;

   type Word_4 is array (0 ..  7) of Bits_4 with Packed, Size => 32;

end Wrong_Aspect;

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

2013-10-10  Ed Schonberg  <schonb...@adacore.com>

        * par-ch13.adb (Aspect_Specifications_Present): In Ada 2012,
        recognize an aspect specification with a misspelled name if it
        is followed by a a comma or semicolon.

Index: par-ch13.adb
===================================================================
--- par-ch13.adb        (revision 203342)
+++ par-ch13.adb        (working copy)
@@ -78,15 +78,19 @@
       --  are in Ada 2012 mode, Strict is False, and we consider that we have
       --  an aspect specification if the identifier is an aspect name (even if
       --  not followed by =>) or the identifier is not an aspect name but is
-      --  followed by =>. P_Aspect_Specifications will generate messages if the
-      --  aspect specification is ill-formed.
+      --  followed by =>, by a comma, or by a semicolon. The last two cases
+      --  correspond to (misspelled) Boolean aspects with a defaulted value of
+      --  True. P_Aspect_Specifications will generate messages if the aspect
+      --  specification is ill-formed.
 
       elsif not Strict then
          if Get_Aspect_Id (Token_Name) /= No_Aspect then
             Result := True;
          else
             Scan; -- past identifier
-            Result := Token = Tok_Arrow;
+            Result := Token = Tok_Arrow
+                         or else Token = Tok_Comma
+                         or else Token = Tok_Semicolon;
          end if;
 
       --  If earlier than Ada 2012, check for valid aspect identifier (possibly

Reply via email to