public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/30614]  New: compiler puts the blame on in parameter mode, not pointer to constant, for assignment to component
@ 2007-01-27 17:11 bauhaus at futureapps dot de
  2008-04-12 20:06 ` [Bug ada/30614] " sam at gcc dot gnu dot org
  2008-11-17 21:17 ` sam at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: bauhaus at futureapps dot de @ 2007-01-27 17:11 UTC (permalink / raw)
  To: gcc-bugs

gcc reports two different error messages, the second of them doesn't
seem to be correct. If it is somehow correct (I don't think so),
it is still misleading:

$ gnatmake -gnatv p.adb
gcc -c -gnatv p.adb

GNAT 4.3.0 20070127 (experimental)
Copyright 1992-2006, Free Software Foundation, Inc.

Compiling: p.adb (source file time stamp: 2007-01-27 13:38:37)

     5.         this.x := value;
                |
        >>> left hand side of assignment must be a variable

    10.         this.x := 42;
                |
        >>> assignment to "in" mode parameter not allowed

 13 lines: 2 errors
gnatmake: "p.adb" compilation error

The first message is correct because "this" is a pointer to constant.
The second message should be the same because the parameter mode should
only affects the mode of the pointer parameter ("this") not the pointee.
(When T_Ptr is made access-to-variable, both lines compile fine.)

package P is

    type T is tagged limited private;
    type T_Ptr is access constant T; -- Note: constant

    procedure reset(this: T_Ptr);
    procedure set(this: T_Ptr; value: Integer);

private

    type T is tagged limited record
        x: Integer;
    end record;

end P;

package body P is

    procedure set(this: T_Ptr; value: Integer) is
    begin
        this.x := value;
    end set;

    procedure reset(this: T_Ptr) is
    begin
        this.x := 42;
    end reset;

end P;


-- 
           Summary: compiler puts the blame on in parameter mode, not
                    pointer to constant, for assignment to component
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: enhancement
          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=30614


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-11-17 21:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-27 17:11 [Bug ada/30614] New: compiler puts the blame on in parameter mode, not pointer to constant, for assignment to component bauhaus at futureapps dot de
2008-04-12 20:06 ` [Bug ada/30614] " sam at gcc dot gnu dot org
2008-11-17 21:17 ` sam at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).