[Bug ada/29112] New: misleading error message for declarations in the wrong place

bauhaus at futureapps dot de gcc-bugzilla@gcc.gnu.org
Sat Sep 16 19:27:00 GMT 2006


When a user tries to declare items e.g. at the
start of the handled_sequence_of_statements
of an accept_statment, the compiler issues
an error message. But it seems to be the default
Junk_Declaration message, which seems kind of wrong
in the following situations:

procedure errmsg is

   task T is
      entry foo;
   end T;

   task body T is
   begin
      accept foo do
            item: INTEGER; -- not allowed, ok
         begin  -- notice the occurence of "begin"
            null;
         end;
      end foo;
   end T;

begin
   null;
end errmsg;

The message is
     9.       accept foo do
    10.             item: INTEGER;
                    |
        >>> declarations must come before "begin"

    11.          begin

The declaration does in fact come before "begin".
The same message here:

procedure errmsg2 is
begin
  x: INTEGER;
  begin
    null;
  end;
end;

To reproduce, run gnatmake on the units.

I though that maybe a rewording might do, something like
"declaration not allowed in HANDLED_SEQUENCE_OF_STATEMENTS"
or
"declaration must be in DECLARATIVE_PART"


-- 
           Summary: misleading error message for declarations in the wrong
                    place
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bauhaus at futureapps dot de
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29112



More information about the Gcc-bugs mailing list