This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15169] [3.5 Regression] " const" on the wrong side of type in error message.
- From: "carlo at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 May 2004 17:02:52 -0000
- Subject: [Bug c++/15169] [3.5 Regression] " const" on the wrong side of type in error message.
- References: <20040427141234.15169.carlo@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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