public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/39859] New: C++: Duplicated and unhelpful error for "c:n"
@ 2009-04-23 0:41 ian at airs dot com
2009-04-29 13:22 ` [Bug c++/39859] duplicated and unhelpful error for "c:n" (parser) manu at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: ian at airs dot com @ 2009-04-23 0:41 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1305 bytes --]
When I compile this erroneous C++ program
namespace n { const int c = 1; }
int foo() { return n:c; }
I get this:
foo.cc: In function int foo():
foo.cc:2: error: expected primary-expression before : token
foo.cc:2: error: expected ; before : token
foo.cc:2: error: expected primary-expression before : token
foo.cc:2: error: expected ; before : token
The duplicated error messages are useless; I think that is a bug.
Even if that bug is fixed, this error message could be better. The error is
using a single colon instead of two colons. "expected primary-expression" is
not helpful to the user. Firstly, as in PR 39858, what is missing is an
expression, not a primary-expression. Secondly, the colon is clearly out of
place; if we found an expression, we would still fail. In this case, we
actually know that we just saw a NAMESPACE_DECL. We can give a better error
message in this context.
--
Summary: C++: Duplicated and unhelpful error for "c:n"
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: trivial
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ian at airs dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39859
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/39859] duplicated and unhelpful error for "c:n" (parser)
2009-04-23 0:41 [Bug c++/39859] New: C++: Duplicated and unhelpful error for "c:n" ian at airs dot com
@ 2009-04-29 13:22 ` manu at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: manu at gcc dot gnu dot org @ 2009-04-29 13:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from manu at gcc dot gnu dot org 2009-04-29 13:21 -------
Confirmed.
--
manu at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu dot org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |diagnostic
Last reconfirmed|0000-00-00 00:00:00 |2009-04-29 13:21:44
date| |
Summary|C++: Duplicated and |duplicated and unhelpful
|unhelpful error for "c:n" |error for "c:n" (parser)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39859
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-04-29 13:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-23 0:41 [Bug c++/39859] New: C++: Duplicated and unhelpful error for "c:n" ian at airs dot com
2009-04-29 13:22 ` [Bug c++/39859] duplicated and unhelpful error for "c:n" (parser) manu 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).