public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15169] New: " const" on the wrong side of type in error message.
@ 2004-04-27 14:27 carlo at gcc dot gnu dot org
  2004-04-27 14:33 ` [Bug c++/15169] [3.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: carlo at gcc dot gnu dot org @ 2004-04-27 14:27 UTC (permalink / raw)
  To: gcc-bugs

Compile:

class A { };

void f ()
{
  A const a = {};
  a->foo;
}

And you get the error:

troep.cc: In function `void f()':
troep.cc:6: error: base operand of `->' has non-pointer type ` constA'

This should be

troep.cc:6: error: base operand of `->' has non-pointer type `A const'

-- 
           Summary: " const" on the wrong side of type in error message.
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: carlo at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/15169] [3.5 Regression] " const" on the wrong side of type in error message.
  2004-04-27 14:27 [Bug c++/15169] New: " const" on the wrong side of type in error message carlo at gcc dot gnu dot org
@ 2004-04-27 14:33 ` pinskia at gcc dot gnu dot org
  2004-05-04 16:47 ` carlo at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-27 14:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-27 14:15 -------
Confirmed and it is caused by one of Gaby's patches to fix the space issue on the error message.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |gdr at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
      Known to fail|                            |3.5.0
      Known to work|                            |3.4.0
   Last reconfirmed|0000-00-00 00:00:00         |2004-04-27 14:15:49
               date|                            |
            Summary|" const" on the wrong side  |[3.5 Regression] " const" on
                   |of type in error message.   |the wrong side of type in
                   |                            |error message.
   Target Milestone|---                         |3.5.0


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


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

* [Bug c++/15169] [3.5 Regression] " const" on the wrong side of type in error message.
  2004-04-27 14:27 [Bug c++/15169] New: " const" on the wrong side of type in error message carlo at gcc dot gnu dot org
  2004-04-27 14:33 ` [Bug c++/15169] [3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-05-04 16:47 ` carlo at gcc dot gnu dot org
  2004-05-04 17:02 ` carlo at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: carlo at gcc dot gnu dot org @ 2004-05-04 16:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From carlo at gcc dot gnu dot org  2004-05-04 16:47 -------
More 'const' and space problems.
I assume the following errors are related to the one descibed above.

../../src/IniFile.cc:88: error: no matching function for call to
`IniFile::Section::Section(xml::node::const_iterator&)'
../../src/include/IniFile.h:39: note: candidates are:
IniFile::Section::Section(constIniFile::Section&)
../../src/include/IniFile.h:63: note:                
IniFile::Section::Section(constxml::node::const_iterator&, IniFile&)
../../src/include/IniFile.h:59: note:                
IniFile::Section::Section(constxml::node::iterator&, IniFile&)

Although there is no space in front of the 'const' here, I expect
this to be solved when the 'const' qualifier is just *always* put
on the righthand side of the type, even if that type is not a pointer
or reference.  Thus,

IniFile::Section::Section(xml::node::iterator const&, IniFile&)



-- 


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


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

* [Bug c++/15169] [3.5 Regression] " const" on the wrong side of type in error message.
  2004-04-27 14:27 [Bug c++/15169] New: " const" on the wrong side of type in error message carlo at gcc dot gnu dot org
  2004-04-27 14:33 ` [Bug c++/15169] [3.5 Regression] " pinskia at gcc dot gnu dot org
  2004-05-04 16:47 ` carlo at gcc dot gnu dot org
@ 2004-05-04 17:02 ` carlo at gcc dot gnu dot org
  2004-05-04 17:14 ` gdr at integrable-solutions dot net
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: carlo at gcc dot gnu dot org @ 2004-05-04 17:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From carlo at gcc dot gnu dot org  2004-05-04 17:02 -------
I meant, even if that type is not a pointer.  A const on the righthand
side of a reference is rather nonsense :).

I mentioned this because the alternative way to correct this would be
to output 'const TYPE' rather than 'TYPE const' in the case 'TYPE'
is not a pointer.  However, I advocate the more consistent form of
'TYPE const' for compiler error and warning messages, which is correct
in all cases (whether or not TYPE is a pointer or not).

Personally I used both styles for many years now and found the 'TYPE const'
one much clearer.  For one thing it allows one to 'pattern recognize'
const-references easier, as they always end on 'const&'.  For example:
void f(Foo const&);
void f(Foo* const&);
both take a const-reference to something as parameter.

The clarity that I experienced would also benefit compiler error messages.
Only if the reader is USED to the 'const TYPE' style he'd prefer this over
the the alternative - but since the compiler is meant for everyone, the most
consistent and (once you are used to it) most clear method should prevail.



-- 


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


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

* [Bug c++/15169] [3.5 Regression] " const" on the wrong side of type in error message.
  2004-04-27 14:27 [Bug c++/15169] New: " const" on the wrong side of type in error message carlo at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-05-04 17:02 ` carlo at gcc dot gnu dot org
@ 2004-05-04 17:14 ` gdr at integrable-solutions dot net
  2004-05-13 11:31 ` pinskia at gcc dot gnu dot org
  2004-06-27 15:34 ` gdr at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-05-04 17:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-05-04 17:14 -------
Subject: Re:  [3.5 Regression] " const" on the wrong side of type in error message.

"carlo at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| More 'const' and space problems.
| I assume the following errors are related to the one descibed above.

| IniFile::Section::Section(constIniFile::Section&)

This is a duplicate of an existing PR.
Patch is pending (in my local tree) to correct it to print

   const IniFile::Section&

The order of appearance of the const is not going to change.

-- Gaby 


-- 


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


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

* [Bug c++/15169] [3.5 Regression] " const" on the wrong side of type in error message.
  2004-04-27 14:27 [Bug c++/15169] New: " const" on the wrong side of type in error message carlo at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-05-04 17:14 ` gdr at integrable-solutions dot net
@ 2004-05-13 11:31 ` pinskia at gcc dot gnu dot org
  2004-06-27 15:34 ` gdr at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-13 11:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-12 19:38 -------
The no space problem is PR 14913.

-- 


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


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

* [Bug c++/15169] [3.5 Regression] " const" on the wrong side of type in error message.
  2004-04-27 14:27 [Bug c++/15169] New: " const" on the wrong side of type in error message carlo at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-05-13 11:31 ` pinskia at gcc dot gnu dot org
@ 2004-06-27 15:34 ` gdr at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-06-27 15:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at gcc dot gnu dot org  2004-06-27 15:32 -------
http://gcc.gnu.org/ml/gcc-patches/2004-06/msg02247.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2004-06-27 15:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-27 14:27 [Bug c++/15169] New: " const" on the wrong side of type in error message carlo at gcc dot gnu dot org
2004-04-27 14:33 ` [Bug c++/15169] [3.5 Regression] " pinskia at gcc dot gnu dot org
2004-05-04 16:47 ` carlo at gcc dot gnu dot org
2004-05-04 17:02 ` carlo at gcc dot gnu dot org
2004-05-04 17:14 ` gdr at integrable-solutions dot net
2004-05-13 11:31 ` pinskia at gcc dot gnu dot org
2004-06-27 15:34 ` gdr 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).