public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16093] New: Bad error messages for missing declarations.
@ 2004-06-20 10:56 carlo at gcc dot gnu dot org
2004-06-20 11:09 ` [Bug c++/16093] " carlo at gcc dot gnu dot org
2004-06-25 23:02 ` pinskia at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: carlo at gcc dot gnu dot org @ 2004-06-20 10:56 UTC (permalink / raw)
To: gcc-bugs
When a declaration is missing, the error returned by the compiler
is too confusing. Consider the following short test case;
namespace n {
int var;
//class foo { };
//template<typename T> class bar { };
}
n::var x1;
n::foo x3;
n::bar<int> x4;
The results in the following errors:
test.cc:7: error: `var' in namespace `n' does not name a type
test.cc:8: error: `foo' in namespace `n' does not name a type
test.cc:9: error: expected constructor, destructor, or type conversion before
'<' token
test.cc:9: error: expected `,' or `;' before '<' token
I'd like to suggest a different error for the case that there is
no declaration at all (this could be tested after it is already
detected that there is an error because foo is not a type):
test.cc:8: error: `foo' in namespace `n' is not declared
And of course, an improvement for templates. For example:
test.cc:9: error: `bar' in namespace `n' is not declared
--
Summary: Bad error messages for missing declarations.
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=16093
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/16093] Bad error messages for missing declarations.
2004-06-20 10:56 [Bug c++/16093] New: Bad error messages for missing declarations carlo at gcc dot gnu dot org
@ 2004-06-20 11:09 ` carlo at gcc dot gnu dot org
2004-06-25 23:02 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: carlo at gcc dot gnu dot org @ 2004-06-20 11:09 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From carlo at gcc dot gnu dot org 2004-06-20 11:09 -------
On second thought, make that:
test.cc:8: error: `n::foo' has not been declared
test.cc:9: error: `n::bar` has not been declared
This is the same format that one gets when doing
using n::foo;
Note that the full namespace should be used - and not
what is literally in the source. Consider:
namespace n1 {
namespace n2 {
}
}
namespace n3 {
namespace n2 {
class foo { };
}
}
using namespace n1;
n2::foo x;
Then one wants: error: `n1::n2::foo' has not been declared
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16093
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/16093] Bad error messages for missing declarations.
2004-06-20 10:56 [Bug c++/16093] New: Bad error messages for missing declarations carlo at gcc dot gnu dot org
2004-06-20 11:09 ` [Bug c++/16093] " carlo at gcc dot gnu dot org
@ 2004-06-25 23:02 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-25 23:02 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-06-25 22:58 -------
Confirmed, there might be another bug with the same problem.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |diagnostic
Last reconfirmed|0000-00-00 00:00:00 |2004-06-25 22:58:22
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16093
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-06-25 22:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-20 10:56 [Bug c++/16093] New: Bad error messages for missing declarations carlo at gcc dot gnu dot org
2004-06-20 11:09 ` [Bug c++/16093] " carlo at gcc dot gnu dot org
2004-06-25 23:02 ` pinskia 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).